All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuhong Yuan <hslester96@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Jens Axboe <axboe@kernel.dk>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>, Tejun Heo <tj@kernel.org>,
	Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>,
	linux-ide@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Chuhong Yuan <hslester96@gmail.com>
Subject: [PATCH] ahci: imx: add a check for devm_thermal_zone_of_sensor_register
Date: Tue, 10 Dec 2019 17:13:36 +0800	[thread overview]
Message-ID: <20191210091336.23331-1-hslester96@gmail.com> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Chuhong Yuan <hslester96@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Chuhong Yuan <hslester96@gmail.com>,
	linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	NXP Linux Team <linux-imx@nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>,
	Tejun Heo <tj@kernel.org>, Fabio Estevam <festevam@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ahci: imx: add a check for devm_thermal_zone_of_sensor_register
Date: Tue, 10 Dec 2019 17:13:36 +0800	[thread overview]
Message-ID: <20191210091336.23331-1-hslester96@gmail.com> (raw)

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

             reply	other threads:[~2019-12-10  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10  9:13 Chuhong Yuan [this message]
2019-12-10  9:13 ` [PATCH] ahci: imx: add a check for devm_thermal_zone_of_sensor_register Chuhong Yuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210091336.23331-1-hslester96@gmail.com \
    --to=hslester96@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=fabien.lahoudere@collabora.co.uk \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.