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>
This commit is contained in:
parent
62f0f39b4a
commit
4d485661d7
|
@ -1157,20 +1157,17 @@ struct device *omap_device_get_by_hwmod_name(const char *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__,
|
||||
oh_name);
|
||||
return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
|
||||
return -ENODEV;
|
||||
}
|
||||
if (IS_ERR_OR_NULL(oh->od)) {
|
||||
if (!oh->od) {
|
||||
WARN(1, "%s: no omap_device for %s\n", __func__,
|
||||
oh_name);
|
||||
return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
|
||||
return -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;
|
||||
}
|
||||
EXPORT_SYMBOL(omap_device_get_by_hwmod_name);
|
||||
|
|
Loading…
Reference in New Issue