All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ahci: imx: add a check for devm_thermal_zone_of_sensor_register
@ 2019-12-10  9:13 ` Chuhong Yuan
  0 siblings, 0 replies; 2+ messages in thread
From: Chuhong Yuan @ 2019-12-10  9:13 UTC (permalink / raw)
  Cc: Jens Axboe, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Tejun Heo, Fabien Lahoudere,
	linux-ide, linux-arm-kernel, linux-kernel, Chuhong Yuan

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")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/ata/ahci_imx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 948d2c6557f3..c6206b3053c6 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -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));
 	}
 
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] ahci: imx: add a check for devm_thermal_zone_of_sensor_register
@ 2019-12-10  9:13 ` Chuhong Yuan
  0 siblings, 0 replies; 2+ messages in thread
From: Chuhong Yuan @ 2019-12-10  9:13 UTC (permalink / raw)
  Cc: Jens Axboe, Shawn Guo, Sascha Hauer, Chuhong Yuan, linux-kernel,
	linux-ide, NXP Linux Team, Pengutronix Kernel Team,
	Fabien Lahoudere, Tejun Heo, Fabio Estevam, linux-arm-kernel

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")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/ata/ahci_imx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 948d2c6557f3..c6206b3053c6 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -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));
 	}
 
-- 
2.24.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-10  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10  9:13 [PATCH] ahci: imx: add a check for devm_thermal_zone_of_sensor_register Chuhong Yuan
2019-12-10  9:13 ` Chuhong Yuan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.