cpuidle: Fix three reference count leaks
authorQiushi Wu <wu000273@umn.edu>
Thu, 28 May 2020 18:20:46 +0000 (13:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Jun 2020 08:24:18 +0000 (10:24 +0200)
commit42b548b9e9248ffd2f378bd4cbcb31d692ef3280
treec99ac1168fc800060411486411bac6f9a8bdad65
parentd6043872c76058256b0ee80511076f00ba9f9020
cpuidle: Fix three reference count leaks

[ Upstream commit c343bf1ba5efcbf2266a1fe3baefec9cc82f867f ]

kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object.

Previous commit "b8eb718348b8" fixed a similar problem.

Signed-off-by: Qiushi Wu <wu000273@umn.edu>
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpuidle/sysfs.c