Skip to contentSkip to conversation

platform/mellanox: mlxreg-dpu: Fix smatch warnings

PATCH Superseded Vadim Pasternak 2 participants 2 messages May 4, 2025 – May 5, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Vadim Pasternak

author maintainer
#0 lore raw

PATCH 1/1 platform/mellanox: mlxreg-dpu: Fix smatch warnings

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

Fixes 3e75f2954116 ("platform/mellanox: mlxreg-dpu: Add initial support for Nvidia DPU")
---
 drivers/platform/mellanox/mlxreg-dpu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/mellanox/mlxreg-dpu.c +3 -2
index 277e4b8cc5cb..805b9bfbc85f 100644
@@ -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;
 	}
 
Signature · 1 line
2.44.0
maintainer
#1 lore raw
Quoted 14 lines · 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")
---
 drivers/platform/mellanox/mlxreg-dpu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/mellanox/mlxreg-dpu.c +0 -0
index 277e4b8cc5cb..805b9bfbc85f 100644

drivers/platform/mellanox/mlxreg-dpu.c static int mlxreg_dpu_probe(struct platform_device *pdev) · line 541

Quoted 8 lines
drivers/platform/mellanox/mlxreg-dpu.c +3 -1
@@ -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??

Quoted 12 lines
drivers/platform/mellanox/mlxreg-dpu.c +0 -1
 	/* 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;
 	}
 
Signature · 1 line
 i.