On Thu, Jul 28, 2011 at 12:53:47AM -0500, Nishanth Menon wrote:
> +struct device *omap_hwmod_to_device(const char *oh_name)
> +{
> +     struct omap_hwmod *oh;
> +
> +     if (!oh_name) {
> +             WARN(1, "%s: no hwmod name!\n", __func__);
> +             return ERR_PTR(-EINVAL);
> +     }
> +
> +     oh = _lookup(oh_name);
> +     if (IS_ERR_OR_NULL(oh)) {
> +             WARN(1, "%s: no hwmod for %s\n", __func__,
> +                     oh_name);
> +             return ERR_PTR(-ENODEV);

It is good practice to always propagate back the error codes from functions
which failed.  So you may need something like:

                return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);

here.

> +     }
> +     if (IS_ERR_OR_NULL(oh->od)) {
> +             WARN(1, "%s: no omap_device for %s\n", __func__,
> +                     oh_name);
> +             return ERR_PTR(-ENODEV);

Same here.
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

Reply via email to