]> git.baikalelectronics.ru Git - kernel.git/commit
thermal/core: fix error code in __thermal_cooling_device_register()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 28 Oct 2022 15:02:34 +0000 (18:02 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:34:26 +0000 (08:34 +0100)
commit282b9a1c3d3a15a2fb0d5db8e45e866660817681
tree543fd647913ab4db1fe17f6eb8b08a54f2be028b
parent29e306d8f7b6d830952160274bbbf5532b5f2309
thermal/core: fix error code in __thermal_cooling_device_register()

[ Upstream commit 4e2729ef5aa8400c15a84a9de558217efc8ec7d8 ]

Return an error pointer if ->get_max_state() fails.  The current code
returns NULL which will cause an oops in the callers.

Fixes: 743160b98189 ("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: f165a55dea80 ("thermal: core: call put_device() only after device_register() fails")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/thermal_core.c