aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-02-24 05:56:59 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-05-02 14:54:21 -0400
commit857835c6d57aef101ac335a6da2149b54e7e0512 (patch)
treedd7946266491158e7f07ccbb497c6bae21c7793c /arch
parent62f0f39b4aa2dce08f08797089e60d945448ca2b (diff)
ARM: cleanup: OMAP hwmod error checking
omap_hwmod_lookup() only returns NULL on error, never an error pointer. Checking the returned pointer using IS_ERR_OR_NULL() is needless overhead. Use a simple !ptr check instead. OMAP devices (oh->od) always have a valid platform device attached (see omap_device_alloc()) so there's no point validating the platform device pointer (we will have already oopsed long before if this is not the case here.) Lastly, oh->od is only ever NULL or a valid omap device pointer - 'oh' comes from the statically declared hwmod tables, and the pointer is only filled in by omap_device_alloc() at a point where the omap device pointer must be valid. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/omap_device.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index e065daa537c0..1bc16cdafdd6 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -1157,20 +1157,17 @@ struct device *omap_device_get_by_hwmod_name(const char *oh_name)
1157 } 1157 }
1158 1158
1159 oh = omap_hwmod_lookup(oh_name); 1159 oh = omap_hwmod_lookup(oh_name);
1160 if (IS_ERR_OR_NULL(oh)) { 1160 if (!oh) {
1161 WARN(1, "%s: no hwmod for %s\n", __func__, 1161 WARN(1, "%s: no hwmod for %s\n", __func__,
1162 oh_name); 1162 oh_name);
1163 return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV); 1163 return ERR_PTR(-ENODEV);
1164 } 1164 }
1165 if (IS_ERR_OR_NULL(oh->od)) { 1165 if (!oh->od) {
1166 WARN(1, "%s: no omap_device for %s\n", __func__, 1166 WARN(1, "%s: no omap_device for %s\n", __func__,
1167 oh_name); 1167 oh_name);
1168 return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV); 1168 return ERR_PTR(-ENODEV);
1169 } 1169 }
1170 1170
1171 if (IS_ERR_OR_NULL(oh->od->pdev))
1172 return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV);
1173
1174 return &oh->od->pdev->dev; 1171 return &oh->od->pdev->dev;
1175} 1172}
1176EXPORT_SYMBOL(omap_device_get_by_hwmod_name); 1173EXPORT_SYMBOL(omap_device_get_by_hwmod_name);