Skip to contentSkip to conversation

Input: sun4i-ts - add a check for devm_thermal_zone_of_sensor_register

PATCH Applied Chuhong Yuan 2 participants 2 messages Dec 10, 2019 – Jan 10, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: sun4i-ts - add a check for devm_thermal_zone_of_sensor_register

The driver misses a check for devm_thermal_zone_of_sensor_register(). Add a check to fix it.

Fixes e28d0c9cd381 ("input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register")
---
 drivers/input/touchscreen/sun4i-ts.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/input/touchscreen/sun4i-ts.c +5 -1
index 0af0fe8c40d7..742a7e96c1b5 100644
@@ -237,6 +237,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct device *hwmon;
+	struct thermal_zone_device *thermal;
 	int error;
 	u32 reg;
 	bool ts_attached;
@@ -355,7 +356,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	if (IS_ERR(hwmon))
 		return PTR_ERR(hwmon);
 
-	devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops);
+	thermal = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts,
+						       &sun4i_ts_tz_ops);
+	if (IS_ERR(thermal))
+		return PTR_ERR(thermal);
 
 	writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
 
Signature · 1 line
2.24.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Chuhong Yuan

The driver misses a check for devm_thermal_zone_of_sensor_register(). Add a check to fix it.

Fixes e28d0c9cd381 ("input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register")

Applied, thank you.

Quoted 31 lines
---
 drivers/input/touchscreen/sun4i-ts.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/input/touchscreen/sun4i-ts.c +5 -1
index 0af0fe8c40d7..742a7e96c1b5 100644
@@ -237,6 +237,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct device *hwmon;
+	struct thermal_zone_device *thermal;
 	int error;
 	u32 reg;
 	bool ts_attached;
@@ -355,7 +356,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	if (IS_ERR(hwmon))
 		return PTR_ERR(hwmon);
 
-	devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops);
+	thermal = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts,
+						       &sun4i_ts_tz_ops);
+	if (IS_ERR(thermal))
+		return PTR_ERR(thermal);
 
 	writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
 
Signature · 1 line
2.24.0
Signature · 1 line
Dmitry