All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH platform-next 1/1] platform/mellanox: mlxreg-dpu: Fix smatch warnings
@ 2025-05-04 16:54 Vadim Pasternak
  2025-05-05 11:42 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Vadim Pasternak @ 2025-05-04 16:54 UTC (permalink / raw)
  To: hdegoede, ilpo.jarvinen
  Cc: michaelsh, dan.carpenter, platform-driver-x86, Vadim Pasternak

Add missed call to release adapter.
Remove wrong error pointer conversion.

Fixes: 3e75f2954116 ("platform/mellanox: mlxreg-dpu: Add initial support for Nvidia DPU")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
---
 drivers/platform/mellanox/mlxreg-dpu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/mellanox/mlxreg-dpu.c b/drivers/platform/mellanox/mlxreg-dpu.c
index 277e4b8cc5cb..805b9bfbc85f 100644
--- a/drivers/platform/mellanox/mlxreg-dpu.c
+++ b/drivers/platform/mellanox/mlxreg-dpu.c
@@ -535,8 +535,10 @@ static int mlxreg_dpu_probe(struct platform_device *pdev)
 		return -EPROBE_DEFER;
 
 	mlxreg_dpu = devm_kzalloc(&pdev->dev, sizeof(*mlxreg_dpu), GFP_KERNEL);
-	if (!mlxreg_dpu)
+	if (!mlxreg_dpu) {
+		i2c_put_adapter(data->hpdev.adapter);
 		return -ENOMEM;
+	}
 
 	/* Create device at the top of DPU I2C tree. */
 	data->hpdev.client = i2c_new_client_device(data->hpdev.adapter,
@@ -562,7 +564,6 @@ static int mlxreg_dpu_probe(struct platform_device *pdev)
 	if (err) {
 		dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n",
 			data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr);
-		err = PTR_ERR(regmap);
 		goto regcache_sync_fail;
 	}
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH platform-next 1/1] platform/mellanox: mlxreg-dpu: Fix smatch warnings
  2025-05-04 16:54 [PATCH platform-next 1/1] platform/mellanox: mlxreg-dpu: Fix smatch warnings Vadim Pasternak
@ 2025-05-05 11:42 ` Ilpo Järvinen
  0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2025-05-05 11:42 UTC (permalink / raw)
  To: Vadim Pasternak
  Cc: Hans de Goede, michaelsh, dan.carpenter, platform-driver-x86

On Sun, 4 May 2025, Vadim Pasternak wrote:

> Add missed call to release adapter.
> Remove wrong error pointer conversion.
> 
> Fixes: 3e75f2954116 ("platform/mellanox: mlxreg-dpu: Add initial support for Nvidia DPU")
> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
> ---
>  drivers/platform/mellanox/mlxreg-dpu.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/mellanox/mlxreg-dpu.c b/drivers/platform/mellanox/mlxreg-dpu.c
> index 277e4b8cc5cb..805b9bfbc85f 100644
> --- a/drivers/platform/mellanox/mlxreg-dpu.c
> +++ b/drivers/platform/mellanox/mlxreg-dpu.c
> @@ -535,8 +535,10 @@ static int mlxreg_dpu_probe(struct platform_device *pdev)
>  		return -EPROBE_DEFER;
>  
>  	mlxreg_dpu = devm_kzalloc(&pdev->dev, sizeof(*mlxreg_dpu), GFP_KERNEL);
> -	if (!mlxreg_dpu)
> +	if (!mlxreg_dpu) {
> +		i2c_put_adapter(data->hpdev.adapter);
>  		return -ENOMEM;
> +	}

Why this doesn't reuse the existing rollbacks??

>  
>  	/* Create device at the top of DPU I2C tree. */
>  	data->hpdev.client = i2c_new_client_device(data->hpdev.adapter,
> @@ -562,7 +564,6 @@ static int mlxreg_dpu_probe(struct platform_device *pdev)
>  	if (err) {
>  		dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n",
>  			data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr);
> -		err = PTR_ERR(regmap);
>  		goto regcache_sync_fail;
>  	}
>  
> 

-- 
 i.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-05 11:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-04 16:54 [PATCH platform-next 1/1] platform/mellanox: mlxreg-dpu: Fix smatch warnings Vadim Pasternak
2025-05-05 11:42 ` Ilpo Järvinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.