Commit 4540e41e authored by Qasim Ijaz's avatar Qasim Ijaz Committed by Jiri Kosina
Browse files

HID: appletb-kbd: fix "appletb_backlight" backlight device reference counting



During appletb_kbd_probe, probe attempts to get the backlight device
by name. When this happens backlight_device_get_by_name looks for a
device in the backlight class which has name "appletb_backlight" and
upon finding a match it increments the reference count for the device
and returns it to the caller. However this reference is never released
leading to a reference leak.

Fix this by decrementing the backlight device reference count on removal
via put_device and on probe failure.

Fixes: 93a0fc48 ("HID: hid-appletb-kbd: add support for automatic brightness control while using the touchbar")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarQasim Ijaz <qasdev00@gmail.com>
Reviewed-by: default avatarAditya Garg <gargaditya08@live.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
parent f3054152
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment