[PATCH 05/10] power: supply: ab8500_btemp: Remove unused global device list

From: Lee Jones

Date: Thu Dec 03 2026 - 11:14:05 EST


ab8500_btemp_probe() links the devm-allocated device structure into the
static ab8500_btemp_list without ever removing it on probe failure or
unbind. A subsequent rebind traverses the freed list node and corrupts
memory.

Since ab8500_btemp_list has had no readers since BATCTRL thermal mode
was removed, delete the unused list and its node field altogether.

Fixes: 1f855824757e ("ab8500-btemp: AB8500 battery temperature driver")
Closes: https://sashiko.dev/#/bug/linux-1b556e1a-3976-4c4b-a368-b92b6f64cc8b
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/power/supply/ab8500_btemp.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c
index 1e11bbe3baaf..5dfee700d65c 100644
--- a/drivers/power/supply/ab8500_btemp.c
+++ b/drivers/power/supply/ab8500_btemp.c
@@ -76,7 +76,6 @@ struct ab8500_btemp_ranges {
/**
* struct ab8500_btemp - ab8500 BTEMP device information
* @dev: Pointer to the structure device
- * @node: List of AB8500 BTEMPs, hence prepared for reentrance
* @curr_source: What current source we use, in uA
* @bat_temp: Dispatched battery temperature in degree Celsius
* @prev_bat_temp Last measured battery temperature in degree Celsius
@@ -94,7 +93,6 @@ struct ab8500_btemp_ranges {
*/
struct ab8500_btemp {
struct device *dev;
- struct list_head node;
int curr_source;
int bat_temp;
int prev_bat_temp;
@@ -118,8 +116,6 @@ static enum power_supply_property ab8500_btemp_props[] = {
POWER_SUPPLY_PROP_TEMP,
};

-static LIST_HEAD(ab8500_btemp_list);
-
/**
* ab8500_btemp_batctrl_volt_to_res() - convert batctrl voltage to resistance
* @di: pointer to the ab8500_btemp structure
@@ -787,8 +783,6 @@ static int ab8500_btemp_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, di);

- list_add_tail(&di->node, &ab8500_btemp_list);
-
return component_add(dev, &ab8500_btemp_component_ops);
}

--
2.56.1.911.g883d8bcb20-goog