Hi!

> Memory for struct v4l2_flash_config is allocated in
> gb_lights_light_v4l2_register() for no gain and yet the allocated memory is
> leaked; the struct isn't used outside the function. Fix this.
> 
> Signed-off-by: Sakari Ailus <sakari.ai...@linux.intel.com>


> diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
> index 129ceed39829..b25c117ec41a 100644
> --- a/drivers/staging/greybus/light.c
> +++ b/drivers/staging/greybus/light.c
> @@ -534,25 +534,21 @@ static int gb_lights_light_v4l2_register(struct 
> gb_light *light)
>  {
>       struct gb_connection *connection = get_conn_from_light(light);
>       struct device *dev = &connection->bundle->dev;
> -     struct v4l2_flash_config *sd_cfg;
> +     struct v4l2_flash_config sd_cfg = { 0 };
>       struct led_classdev_flash *fled;
>       struct led_classdev *iled = NULL;
>       struct gb_channel *channel_torch, *channel_ind, *channel_flash;
>       int ret = 0;
....
>       light->v4l2_flash = v4l2_flash_init(dev, NULL, fled, iled,
> -                                         &v4l2_flash_ops, sd_cfg);
> +                                         &v4l2_flash_ops, &sd_cfg);
>       if (IS_ERR_OR_NULL(light->v4l2_flash)) {
>               ret = PTR_ERR(light->v4l2_flash);
>               goto out_free;

Acked-by: Pavel Machek <pa...@ucw.cz>

struct v4l2_flash *v4l2_flash_init(
        struct device *dev, struct fwnode_handle *fwn,
               struct led_classdev_flash *fled_cdev,
                      struct led_classdev_flash *iled_cdev,
                             const struct v4l2_flash_ops *ops,
                                   struct v4l2_flash_config *config)
                                   
This function saves "ops" argument, but is careful to copy from
"config" argument. Perhaps that's worth a comment?

Thanks,
                                                                Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature

Reply via email to