mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
thermal/core: fix error code in __thermal_cooling_device_register()
[ Upstream commite49a1e1ee0
] Return an error pointer if ->get_max_state() fails. The current code returns NULL which will cause an oops in the callers. Fixes:c408b3d1d9
("thermal: Validate new state in cur_state_store()") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Stable-dep-of:6c54b7bc8a
("thermal: core: call put_device() only after device_register() fails") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
80bb3b901a
commit
d4dbbbbb24
@ -892,7 +892,8 @@ __thermal_cooling_device_register(struct device_node *np,
|
||||
cdev->device.class = &thermal_class;
|
||||
cdev->devdata = devdata;
|
||||
|
||||
if (cdev->ops->get_max_state(cdev, &cdev->max_state))
|
||||
ret = cdev->ops->get_max_state(cdev, &cdev->max_state);
|
||||
if (ret)
|
||||
goto out_kfree_type;
|
||||
|
||||
thermal_cooling_device_setup_sysfs(cdev);
|
||||
|
Loading…
Reference in New Issue
Block a user