Skip to content

Commit 3494a59

Browse files
KunWuChanij-intel
authored andcommitted
platform/mellanox: Check devm_hwmon_device_register_with_groups() return value
devm_hwmon_device_register_with_groups() returns an error pointer upon failure. Check its return value for errors. Compile-tested only. Fixes: 1a218d3 ("platform/mellanox: mlxbf-pmc: Add Mellanox BlueField PMC driver") Suggested-by: Ilpo Järvinen <[email protected]> Suggested-by: Vadim Pasternak <[email protected]> Signed-off-by: Kunwu Chan <[email protected]> Reviewed-by: Vadim Pasternak <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ij: split the change into two] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 2c7c857 commit 3494a59

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/platform/mellanox/mlxbf-pmc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,6 +2075,8 @@ static int mlxbf_pmc_probe(struct platform_device *pdev)
20752075

20762076
pmc->hwmon_dev = devm_hwmon_device_register_with_groups(
20772077
dev, "bfperf", pmc, pmc->groups);
2078+
if (IS_ERR(pmc->hwmon_dev))
2079+
return PTR_ERR(pmc->hwmon_dev);
20782080
platform_set_drvdata(pdev, pmc);
20792081

20802082
return 0;

0 commit comments

Comments
 (0)