Commit 3494a594 authored by Kunwu Chan's avatar Kunwu Chan Committed by Ilpo Järvinen

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: 1a218d31 ("platform/mellanox: mlxbf-pmc: Add Mellanox BlueField PMC driver")
Suggested-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Suggested-by: default avatarVadim Pasternak <vadimp@nvidia.com>
Signed-off-by: default avatarKunwu Chan <chentao@kylinos.cn>
Reviewed-by: default avatarVadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20231201055447.2356001-1-chentao@kylinos.cn
[ij: split the change into two]
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent 2c7c857f
...@@ -2075,6 +2075,8 @@ static int mlxbf_pmc_probe(struct platform_device *pdev) ...@@ -2075,6 +2075,8 @@ static int mlxbf_pmc_probe(struct platform_device *pdev)
pmc->hwmon_dev = devm_hwmon_device_register_with_groups( pmc->hwmon_dev = devm_hwmon_device_register_with_groups(
dev, "bfperf", pmc, pmc->groups); dev, "bfperf", pmc, pmc->groups);
if (IS_ERR(pmc->hwmon_dev))
return PTR_ERR(pmc->hwmon_dev);
platform_set_drvdata(pdev, pmc); platform_set_drvdata(pdev, pmc);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment