pm_runtime functions and IS_ERR_VALUE (was Re: [PATCH v6] ARM: omap:edma: add suspend suspend/resume hooks)

From: Nishanth Menon
Date: Wed Nov 27 2013 - 18:17:26 EST


Change in subject line + wider forum

On 19:24-20131127, Sekhar Nori wrote:
> On Wednesday 27 November 2013 07:17 PM, Daniel Mack wrote:
> > On 11/27/2013 02:35 PM, Sekhar Nori wrote:
> >> On Monday 18 November 2013 03:49 AM, Daniel Mack wrote:
> >>> +static int edma_pm_suspend(struct device *dev)
> >>> +{
> >>> + int j, r;
> >>> +
> >>> + r = pm_runtime_get_sync(dev);
> >>> + if (IS_ERR_VALUE(r)) {
> >>
> >> So IS_ERR_VALUE() is only for functions which may return a negative
> >> number outside of MAX_ERRNO as a success indication.
> >> pm_runtime_get_sync() does not appear to be one of them so just use"
> >>
> >> if (r < 0) { .. }
> >
> > That's true. Thanks for catching this, I'll fix it. However, grepping
> > through the tree, there are quite a lot places where the same mistake is
> > made.
>
> Yes, this is a common fallacy. Russell cleaned up a bunch of these a
> while back.

Thinking a little more on this front, to prevent recurrence and fixing
the ones we already have, how about something like the following
patch?

For example, on 3.13-rc1, with omap2plus_defconfig, I see the following:
http://pastebin.mozilla.org/3681911

-->8--