greybus: lights: remove has_flash on failure
authorRui Miguel Silva <rui.silva@linaro.org>
Wed, 17 Feb 2016 14:32:52 +0000 (14:32 +0000)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 17 Feb 2016 23:24:09 +0000 (15:24 -0800)
If register to v4l2 fails just mark the light as not having flash so in
release we do not try to unregister.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/light.c

index 6c5b9994457cb28d0666eedc5927bbc8e917c770..4c46d149cb7d40f0591ff20500546f55b052806f 100644 (file)
@@ -1004,8 +1004,10 @@ static int gb_lights_light_register(struct gb_light *light)
 
        if (light->has_flash) {
                ret = gb_lights_light_v4l2_register(light);
-               if (ret < 0)
+               if (ret < 0) {
+                       light->has_flash = false;
                        return ret;
+               }
        }
 
        return 0;