Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1449438 > unrolled thread

Re: [PATCH v2] platform: don't return 0 from platform_get_irq[_byname]() on error

Started bySergei Shtylyov <sergei.shtylyov@cogentembedded.com>
First post2016-07-25 14:00 +0200
Last post2016-07-25 18:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2] platform: don't return 0 from  platform_get_irq[_byname]() on error Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-07-25 14:00 +0200
    Re: [PATCH v2] platform: don't return 0 from  platform_get_irq[_byname]() on error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-07-25 18:50 +0200

#1449438 — Re: [PATCH v2] platform: don't return 0 from platform_get_irq[_byname]() on error

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2016-07-25 14:00 +0200
SubjectRe: [PATCH v2] platform: don't return 0 from platform_get_irq[_byname]() on error
Message-ID<rYMIa-477-19@gated-at.bofh.it>
Hello.

On 7/4/2016 1:04 AM, Sergei Shtylyov wrote:

> of_irq_get[_byname]() return 0 iff  irq_create_of_mapping() call fails.
> Returning both  error code and 0 on failure is a sign of a misdesigned API,
> it makes the failure check unnecessarily complex and error prone. We should
> rely  on the platform IRQ resource in this case, not return 0,  especially
> as 0 can be  a valid  IRQ resource too...
>
> Fixes: aff008ad813c ("platform_get_irq: Revert to platform_get_resource if of_irq_get fails")
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> CC: stable@vger.kernel.org

    4.7 has been tagged now. Can I count on this patch getting to 4.8? Or at 
least some feedback given? :-/

> ---
> The patch is against the 'driver-core-linus' branch of Greg KH's
> 'driver-core.git' repo.
>
> See also commit 3993546646ba ("of: irq: fix of_irq_get[_byname]() kernel-doc")
>
> Changes in version 2:
> - expanded the changelog.
>
>  drivers/base/platform.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: driver-core/drivers/base/platform.c
> ===================================================================
> --- driver-core.orig/drivers/base/platform.c
> +++ driver-core/drivers/base/platform.c
> @@ -97,7 +97,7 @@ int platform_get_irq(struct platform_dev
>  		int ret;
>
>  		ret = of_irq_get(dev->dev.of_node, num);
> -		if (ret >= 0 || ret == -EPROBE_DEFER)
> +		if (ret > 0 || ret == -EPROBE_DEFER)
>  			return ret;
>  	}
>
> @@ -175,7 +175,7 @@ int platform_get_irq_byname(struct platf
>  		int ret;
>
>  		ret = of_irq_get_byname(dev->dev.of_node, name);
> -		if (ret >= 0 || ret == -EPROBE_DEFER)
> +		if (ret > 0 || ret == -EPROBE_DEFER)
>  			return ret;
>  	}
>

MBR, Sergei

[toc] | [next] | [standalone]


#1449651

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-07-25 18:50 +0200
Message-ID<rYReN-6TV-9@gated-at.bofh.it>
In reply to#1449438
On Mon, Jul 25, 2016 at 02:55:37PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 7/4/2016 1:04 AM, Sergei Shtylyov wrote:
> 
> > of_irq_get[_byname]() return 0 iff  irq_create_of_mapping() call fails.
> > Returning both  error code and 0 on failure is a sign of a misdesigned API,
> > it makes the failure check unnecessarily complex and error prone. We should
> > rely  on the platform IRQ resource in this case, not return 0,  especially
> > as 0 can be  a valid  IRQ resource too...
> > 
> > Fixes: aff008ad813c ("platform_get_irq: Revert to platform_get_resource if of_irq_get fails")
> > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> > CC: stable@vger.kernel.org
> 
>    4.7 has been tagged now. Can I count on this patch getting to 4.8? Or at
> least some feedback given? :-/

I'll get to it after 4.8-rc1 is out, but ideally one of the of
developers would look at it, as I have no way to test this...

thanks,

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web