Commit 857835c6 authored by Russell King's avatar Russell King

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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 62f0f39b
...@@ -1157,20 +1157,17 @@ struct device *omap_device_get_by_hwmod_name(const char *oh_name) ...@@ -1157,20 +1157,17 @@ struct device *omap_device_get_by_hwmod_name(const char *oh_name)
} }
oh = omap_hwmod_lookup(oh_name); oh = omap_hwmod_lookup(oh_name);
if (IS_ERR_OR_NULL(oh)) { if (!oh) {
WARN(1, "%s: no hwmod for %s\n", __func__, WARN(1, "%s: no hwmod for %s\n", __func__,
oh_name); oh_name);
return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV); return ERR_PTR(-ENODEV);
} }
if (IS_ERR_OR_NULL(oh->od)) { if (!oh->od) {
WARN(1, "%s: no omap_device for %s\n", __func__, WARN(1, "%s: no omap_device for %s\n", __func__,
oh_name); oh_name);
return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV); return ERR_PTR(-ENODEV);
} }
if (IS_ERR_OR_NULL(oh->od->pdev))
return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV);
return &oh->od->pdev->dev; return &oh->od->pdev->dev;
} }
EXPORT_SYMBOL(omap_device_get_by_hwmod_name); EXPORT_SYMBOL(omap_device_get_by_hwmod_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment