From bf9deb29e2b3c5dbc97ce559325f4faa0bad5022 Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Thu, 25 Feb 2016 18:05:09 +0000 Subject: [PATCH] greybus: lights: remove unnecessary check 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 Signed-off-by: Rui Miguel Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/light.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index 17877f7e2ee4..47d4ac4533bc 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -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); -- 2.20.1