Commit d0a43c12 authored by Guangqing Zhu's avatar Guangqing Zhu Committed by Sebastian Reichel

power: supply: cpcap-battery: fix invalid usage of list cursor

Fix invalid usage of a list_for_each_entry in cpcap_battery_irq_thread().
Empty list or fully traversed list points to list head, which is not
NULL (and before the first element containing real data).
Signed-off-by: default avatarGuangqing Zhu <zhuguangqing83@gmail.com>
Reviewed-by: default avatarTony Lindgren <tony@atomide.com>
Reviewed-by: default avatarCarl Philipp Klemm <philipp@uvos.xyz>
Tested-by: default avatarCarl Philipp Klemm <philipp@uvos.xyz>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 43d87663
......@@ -786,7 +786,7 @@ static irqreturn_t cpcap_battery_irq_thread(int irq, void *data)
break;
}
if (!d)
if (list_entry_is_head(d, &ddata->irq_list, node))
return IRQ_NONE;
latest = cpcap_battery_latest(ddata);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment