media: staging: greybus: light: fix memory leak in v4l2 register
authorRui Miguel Silva <rmfrfs@gmail.com>
Wed, 2 Aug 2017 16:52:57 +0000 (12:52 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sun, 27 Aug 2017 00:25:01 +0000 (20:25 -0400)
commit428359cbfe086f43cb84b7ab7b48e7e7862700e2
treeb35ac495063e4b228748e1b6ca935aa4ad0b3db3
parentb7aaf8220aee35490751cd43861a3f61d63bda67
media: staging: greybus: light: fix memory leak in v4l2 register

We are allocating memory for the v4l2 flash configuration structure and
leak it in the normal path. Just use the stack for this as we do not
use it outside of this function.

Also use IS_ERR() instead of IS_ERR_OR_NULL() to check return value from
v4l2_flash_init() for it never returns NULL.

Fixes: 2870b52bae4c ("greybus: lights: add lights implementation")

Reported-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/staging/greybus/light.c