提交 dc875c77 编写于 作者: R Rui Miguel Silva 提交者: Greg Kroah-Hartman

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: NRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 3855eeec
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册