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 <rui.silva@linaro.org>
Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
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);