[PATCH] bnxt_en: Fix call to hardware monitoring event handler

Guenter Roeck posted 1 patch 1 month, 1 week ago
drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] bnxt_en: Fix call to hardware monitoring event handler
Posted by Guenter Roeck 1 month, 1 week ago
The first parameter of hwmon_notify_event() is supposed to be the hardware
monitoring device. The bnxt driver calls it with the platform device as
first parameter instead. This API break results in undefined behavior and
may result in a crash.

Pass the hardware monitoring device as parameter instead to fix the
problem.

Fixes: a19b4801457b0 ("bnxt_en: Event handler for Thermal event")
Cc: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c
index de3427c6c6aa..faed0cf726e1 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c
@@ -40,7 +40,7 @@ void bnxt_hwmon_notify_event(struct bnxt *bp)
 		return;
 	}
 
-	hwmon_notify_event(&bp->pdev->dev, hwmon_temp, attr, 0);
+	hwmon_notify_event(bp->hwmon_dev, hwmon_temp, attr, 0);
 }
 
 static int bnxt_hwrm_temp_query(struct bnxt *bp, u8 *temp)
-- 
2.45.2
Re: [PATCH] bnxt_en: Fix call to hardware monitoring event handler
Posted by Vadim Fedorenko 1 month, 1 week ago
On 21/08/2026 05:45, Guenter Roeck wrote:
> The first parameter of hwmon_notify_event() is supposed to be the hardware
> monitoring device. The bnxt driver calls it with the platform device as
> first parameter instead. This API break results in undefined behavior and
> may result in a crash.
> 
> Pass the hardware monitoring device as parameter instead to fix the
> problem.
> 
> Fixes: a19b4801457b0 ("bnxt_en: Event handler for Thermal event")
> Cc: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>   drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c
> index de3427c6c6aa..faed0cf726e1 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwmon.c
> @@ -40,7 +40,7 @@ void bnxt_hwmon_notify_event(struct bnxt *bp)
>   		return;
>   	}
>   
> -	hwmon_notify_event(&bp->pdev->dev, hwmon_temp, attr, 0);
> +	hwmon_notify_event(bp->hwmon_dev, hwmon_temp, attr, 0);
>   }
>   
>   static int bnxt_hwrm_temp_query(struct bnxt *bp, u8 *temp)

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Re: [PATCH] bnxt_en: Fix call to hardware monitoring event handler
Posted by Kalesh Anakkur Purayil 1 month, 1 week ago
On Fri, Aug 21, 2026 at 10:15 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> The first parameter of hwmon_notify_event() is supposed to be the hardware
> monitoring device. The bnxt driver calls it with the platform device as
> first parameter instead. This API break results in undefined behavior and
> may result in a crash.
>
> Pass the hardware monitoring device as parameter instead to fix the
> problem.
>
> Fixes: a19b4801457b0 ("bnxt_en: Event handler for Thermal event")
> Cc: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Thank you for the fix, LGTM!

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

-- 
Regards,
Kalesh AP