diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2018-07-02 22:05:21 +0200 |
---|---|---|
committer | Jacek Anaszewski <jacek.anaszewski@gmail.com> | 2018-07-05 23:21:10 +0200 |
commit | 2282e125a406e09331c5a785e3df29035c99a607 (patch) | |
tree | b5936ee2bde7c85bf71aaff259026857b2bda6d9 /drivers/usb/core | |
parent | 033692eb3ec8305f6e9998b297aaec6899680637 (diff) |
leds: triggers: let struct led_trigger::activate() return an error code
Given that activating a trigger can fail, let the callback return an
indication. This prevents to have a trigger active according to the
"trigger" sysfs attribute but not functional.
All users are changed accordingly to return 0 for now. There is no intended
change in behaviour.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/ledtrig-usbport.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c index d775ffea20c3..aa1d51458da7 100644 --- a/drivers/usb/core/ledtrig-usbport.c +++ b/drivers/usb/core/ledtrig-usbport.c @@ -298,14 +298,14 @@ static int usbport_trig_notify(struct notifier_block *nb, unsigned long action, return NOTIFY_DONE; } -static void usbport_trig_activate(struct led_classdev *led_cdev) +static int usbport_trig_activate(struct led_classdev *led_cdev) { struct usbport_trig_data *usbport_data; int err; usbport_data = kzalloc(sizeof(*usbport_data), GFP_KERNEL); if (!usbport_data) - return; + return 0; usbport_data->led_cdev = led_cdev; /* List of ports */ @@ -322,10 +322,11 @@ static void usbport_trig_activate(struct led_classdev *led_cdev) usb_register_notify(&usbport_data->nb); led_cdev->activated = true; - return; + return 0; err_free: kfree(usbport_data); + return 0; } static void usbport_trig_deactivate(struct led_classdev *led_cdev) |