From adb57cff54dd4418f4d5b17f03a976dfdc670226 Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Tue, 12 Jan 2016 14:38:21 +0000 Subject: [PATCH] greybus: power_supply: fix check for configured supply The correct check for if the power supply is ready to receive event is wrong and it should check for the registered flag. Signed-off-by: Rui Miguel Silva Reported-by: Johan Hovold Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/power_supply.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index d985e13b5a0d..2dc193a081b0 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -697,7 +697,8 @@ static int gb_power_supply_event_recv(u8 type, struct gb_operation *op) payload = request->payload; psy_id = payload->psy_id; mutex_lock(&supplies->supplies_lock); - if (psy_id >= supplies->supplies_count || !&supplies->supply[psy_id]) { + if (psy_id >= supplies->supplies_count || + !supplies->supply[psy_id].registered) { dev_err(&connection->bundle->dev, "Event received for unconfigured power_supply id: %d\n", psy_id);