Commit 1f44f221 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Todd Kjos
Browse files

UPSTREAM: thermal: sysfs: Fix cooling_device_stats_setup() error code path



If cooling_device_stats_setup() fails to create the stats object, it
must clear the last slot in cooling_device_attr_groups that was
initially empty (so as to make it possible to add stats attributes to
the cooling device attribute groups).

Failing to do so may cause the stats attributes to be created by
mistake for a device that doesn't have a stats object, because the
slot in question might be populated previously during the registration
of another cooling device.

Bug:255710445

Fixes: 8ea22951 ("thermal: Add cooling device's statistics in sysfs")
Reported-by: default avatarDi Shen <di.shen@unisoc.com>
Tested-by: default avatarDi Shen <di.shen@unisoc.com>
Cc: 4.17+ <stable@vger.kernel.org> # 4.17+
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit d5a8aa5d
git: //git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git)
Signed-off-by: default avatarDi Shen <di.shen@unisoc.com>
Change-Id: If05f9cf8131a0b78431215c3774587954c914b6c
parent 161b98aa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment