Skip to contentSkip to conversation

cpufreq: OMAP: Check IS_ERR() instead of NULL for omap_device_get_by_hwmod_name

PATCH In review Axel Lin 3 participants 4 messages Sep 18, 2012 – Sep 19, 2012 CPU frequency scaling framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 cpufreq: OMAP: Check IS_ERR() instead of NULL for omap_device_get_by_hwmod_name

omap_device_get_by_hwmod_name() returns ERR_PTR on error.

---
 drivers/cpufreq/omap-cpufreq.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/omap-cpufreq.c +2 -2
index 6e22f44..65f8e9a 100644
@@ -266,9 +266,9 @@ static int __init omap_cpufreq_init(void)
 	}
 
 	mpu_dev = omap_device_get_by_hwmod_name("mpu");
-	if (!mpu_dev) {
+	if (IS_ERR(mpu_dev)) {
 		pr_warning("%s: unable to get the mpu device\n", __func__);
-		return -EINVAL;
+		return PTR_ERR(mpu_dev);
 	}
 
 	mpu_reg = regulator_get(mpu_dev, "vcc");
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 3 lines · Axel Lin

omap_device_get_by_hwmod_name() returns ERR_PTR on error.

Kevin, should I take this?

Rafael

Quoted 21 lines
---
 drivers/cpufreq/omap-cpufreq.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/omap-cpufreq.c +2 -2
index 6e22f44..65f8e9a 100644
@@ -266,9 +266,9 @@ static int __init omap_cpufreq_init(void)
 	}
 
 	mpu_dev = omap_device_get_by_hwmod_name("mpu");
-	if (!mpu_dev) {
+	if (IS_ERR(mpu_dev)) {
 		pr_warning("%s: unable to get the mpu device\n", __func__);
-		return -EINVAL;
+		return PTR_ERR(mpu_dev);
 	}
 
 	mpu_reg = regulator_get(mpu_dev, "vcc");