summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVadim Pasternak <vadimp@nvidia.com>2025-05-08 23:31:39 +0300
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2025-05-11 23:41:17 +0300
commitf94ffc3f0b90bf4880e0abf2c056fc465e2c3be8 (patch)
treec72927c76c9a8f221dba2b2642678e4161265ac6 /drivers
parent8e725ff0419ad74dc79abfbdcd4cfba936a5d167 (diff)
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") Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20250508203139.55171-1-vadimp@nvidia.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/mellanox/mlxreg-dpu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/platform/mellanox/mlxreg-dpu.c b/drivers/platform/mellanox/mlxreg-dpu.c
index 277e4b8cc5cb..52260106a9f1 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)
- return -ENOMEM;
+ if (!mlxreg_dpu) {
+ err = -ENOMEM;
+ goto alloc_fail;
+ }
/* 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;
}
@@ -581,6 +582,7 @@ regcache_sync_fail:
devm_regmap_init_i2c_fail:
i2c_unregister_device(data->hpdev.client);
i2c_new_device_fail:
+alloc_fail:
i2c_put_adapter(data->hpdev.adapter);
return err;
}