greybus: lights: remove unnecessary check
authorRui Miguel Silva <rui.silva@linaro.org>
Thu, 25 Feb 2016 18:05:09 +0000 (18:05 +0000)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 26 Feb 2016 00:54:11 +0000 (16:54 -0800)
lights can never be NULL at that point since lights_count must be different than
zero, and we need only to validate the light_id.

Reported-by: Johan Hovold <johan@hovoldconsulting.com>
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 17877f7e2ee4cf86acda4b04d9e020833ab3d954..47d4ac4533bc2fc0fd918388953085890282f553 100644 (file)
@@ -1178,7 +1178,7 @@ static int gb_lights_request_handler(struct gb_operation *op)
        payload = request->payload;
        light_id = payload->light_id;
 
-       if (light_id >= glights->lights_count || !glights->lights ||
+       if (light_id >= glights->lights_count ||
            !glights->lights[light_id].ready) {
                dev_err(dev, "Event received for unconfigured light id: %d\n",
                        light_id);