Subject: Re: [PATCH net-next v4] eth: fbnic: Add hardware monitoring support via HWMON interface

From: Simon Horman <[email-masked]>
Date: Wed, 9 Oct 2024 13:31:07 +0100

On Tue, Oct 08, 2024 at 07:32:12AM -0700, Sanman Pradhan wrote:
> From: Sanman Pradhan <[email-masked]>
> 
> This patch adds support for hardware monitoring to the fbnic driver,
> allowing for temperature and voltage sensor data to be exposed to
> userspace via the HWMON interface. The driver registers a HWMON device
> and provides callbacks for reading sensor data, enabling system
> admins to monitor the health and operating conditions of fbnic.
> 
> Signed-off-by: Sanman Pradhan <[email-masked]>

...

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
> index a4809fe0fc24..10b9573d829e 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
> @@ -289,9 +289,11 @@ static int fbnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> 
>  	fbnic_devlink_register(fbd);
> 
> +	fbnic_hwmon_register(fbd);
> +
>  	if (!fbd->dsn) {
>  		dev_warn(&pdev->dev, "Reading serial number failed\n");
> -		goto init_failure_mode;
> +		goto hwmon_unregister;
>  	}
> 
>  	netdev = fbnic_netdev_alloc(fbd);

Hi Sanman,

The code immediately after the hunk above is:

	if (!netdev) {
		dev_err(&pdev->dev, "Netdev allocation failed\n");
		goto init_failure_mode;
	}

I think it's error-path needs to be update to goto hwmon_unregister
rather than init_failure_mode.

> @@ -310,6 +312,8 @@ static int fbnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> 
>  ifm_free_netdev:
>  	fbnic_netdev_free(fbd);
> +hwmon_unregister:
> +	fbnic_hwmon_unregister(fbd);
>  init_failure_mode:
>  	dev_init_failure_modewarn(&pdev->dev, "Probe error encountered, entering init failure mode. Normal networking functionality will not be available.\n");
>  	 /* Always return 0 even on error so devlink is registered to allow

...

-- 
pw-bot: cr