Skip to contentSkip to conversation

ahci: imx: add a check for devm_thermal_zone_of_sensor_register

PATCH New Chuhong Yuan 1 participant 1 message Dec 10, 2019

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

PATCH 1/1 ahci: imx: 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 54643a83b41a ("ahci: imx: Add imx53 SATA temperature sensor support")
---
 drivers/ata/ahci_imx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/ata/ahci_imx.c +7 -1
index 948d2c6557f3..c6206b3053c6 100644
@@ -1121,6 +1121,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
 	    IS_ENABLED(CONFIG_HWMON)) {
 		/* Add the temperature monitor */
 		struct device *hwmon_dev;
+		struct thermal_zone_device *thermal_dev;
 
 		hwmon_dev =
 			devm_hwmon_device_register_with_groups(dev,
@@ -1131,8 +1132,13 @@ static int imx_ahci_probe(struct platform_device *pdev)
 			ret = PTR_ERR(hwmon_dev);
 			goto disable_clk;
 		}
-		devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
+		thermal_dev = devm_thermal_zone_of_sensor_register(hwmon_dev,
+					     0, hwmon_dev,
 					     &fsl_sata_ahci_of_thermal_ops);
+		if (IS_ERR(thermal_dev)) {
+			ret = PTR_ERR(thermal_dev);
+			goto disable_clk;
+		}
 		dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev));
 	}
 
Signature · 1 line
2.24.0