On Wed, Mar 30, 2011 at 05:19:20PM +0200, [email protected] wrote:
> +/*
> + * omap_hwmod_set_wkup_constraint- set/release a wake-up latency constraint
> + *
> + * @oh: struct omap_hwmod* to which the target device belongs to.
> + * @cookie: identifier of the constraints list for @oh.
> + * @min_latency: the minimum allowed wake-up latency for @oh.
> + *
> + * Returns 0 upon success.
> + */
> +int omap_hwmod_set_wkup_lat_constraint(struct omap_hwmod *oh,
> +                                    void *cookie, long min_latency)
> +{
> +     struct powerdomain *pwrdm = omap_hwmod_get_pwrdm(oh);
> +
> +     if (!PTR_ERR(pwrdm)) {
> +             pr_err("%s: Error: could not find powerdomain "
> +                    "for %s\n", __func__, oh->name);
> +             return -EINVAL;
> +     }

If omap_hwmod_get_pwrdm() returns errors encoded into pointers, then:

        if (IS_ERR(pwrdm)) {
                ...
                return PTR_ERR(pwrdm);
        }

If it doesn't, then:

        if (!pwrdm) {
                ...
                return -EINVAL;
        }

Note that PTR_ERR returns true for both valid error codes and valid
pointers.  Use the interface correctly and don't take shortcuts.  They
don't work.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to