mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
platform/mellanox: Check devm_hwmon_device_register_with_groups() return value
[ Upstream commit3494a59431
] devm_hwmon_device_register_with_groups() returns an error pointer upon failure. Check its return value for errors. Compile-tested only. Fixes:1a218d312e
("platform/mellanox: mlxbf-pmc: Add Mellanox BlueField PMC driver") Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Suggested-by: Vadim Pasternak <vadimp@nvidia.com> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20231201055447.2356001-1-chentao@kylinos.cn [ij: split the change into two] Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8b2688f9c5
commit
15e1490022
1 changed files with 2 additions and 0 deletions
|
@ -1454,6 +1454,8 @@ static int mlxbf_pmc_probe(struct platform_device *pdev)
|
|||
|
||||
pmc->hwmon_dev = devm_hwmon_device_register_with_groups(
|
||||
dev, "bfperf", pmc, pmc->groups);
|
||||
if (IS_ERR(pmc->hwmon_dev))
|
||||
return PTR_ERR(pmc->hwmon_dev);
|
||||
platform_set_drvdata(pdev, pmc);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue