From dc875c77900dba5d177f9219492fd60c046feec8 Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Fri, 30 Sep 2016 19:24:33 +0100 Subject: staging: greybus: light: check delay_{on|off} before use Even though we trust leds core that the pointers should be valid, we are safer to check delay_{on|off} before use. Also, this avoid a smatch warning: drivers/staging/greybus/light.c:484 gb_blink_set() warn: variable dereferenced before check 'delay_on' (see line 476) Signed-off-by: Rui Miguel Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/light.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/staging/greybus') diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index f3cd48521af0..80dc4a9d9a0e 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -463,6 +463,9 @@ static int gb_blink_set(struct led_classdev *cdev, unsigned long *delay_on, if (channel->releasing) return -ESHUTDOWN; + if (!delay_on || !delay_off) + return -EINVAL; + mutex_lock(&channel->lock); ret = gb_pm_runtime_get_sync(bundle); if (ret < 0) -- cgit v1.2.3