Skip to content

Commit f94ffc3

Browse files
vadimp-nvidiaij-intel
authored andcommitted
platform/mellanox: mlxreg-dpu: Fix smatch warnings
Add missed call to release adapter. Remove wrong error pointer conversion. Fixes: 3e75f29 ("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>
1 parent 8e725ff commit f94ffc3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/platform/mellanox/mlxreg-dpu.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,10 @@ static int mlxreg_dpu_probe(struct platform_device *pdev)
535535
return -EPROBE_DEFER;
536536

537537
mlxreg_dpu = devm_kzalloc(&pdev->dev, sizeof(*mlxreg_dpu), GFP_KERNEL);
538-
if (!mlxreg_dpu)
539-
return -ENOMEM;
538+
if (!mlxreg_dpu) {
539+
err = -ENOMEM;
540+
goto alloc_fail;
541+
}
540542

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

@@ -581,6 +582,7 @@ static int mlxreg_dpu_probe(struct platform_device *pdev)
581582
devm_regmap_init_i2c_fail:
582583
i2c_unregister_device(data->hpdev.client);
583584
i2c_new_device_fail:
585+
alloc_fail:
584586
i2c_put_adapter(data->hpdev.adapter);
585587
return err;
586588
}

0 commit comments

Comments
 (0)