From: Roel Kluin <12o3l-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 2/2 v2] xilinx_spi: test below 0 on unsigned irq in xilinx_spi_probe()
Date: Thu, 24 Apr 2008 09:35:09 +0200 [thread overview]
Message-ID: <4810382D.8040405@tiscali.nl> (raw)
In-Reply-To: <480FA248.7080900-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
Joe Perches wrote:
> On Wed, 2008-04-23 at 22:55 +0200, Roel Kluin wrote:
>> - xspi->irq = platform_get_irq(dev, 0);
>> - if (xspi->irq < 0) {
>> - ret = -ENXIO;
>> + ret = platform_get_irq(dev, 0);
>> + if (ret < 0)
>> goto unmap_io;
>> - }
>> +
>> + xspi->irq = ret;
>> + ret = 0;
>
> Is the only negative return from platform_get_irq ENXIO?
> I think you still need the ret = -ENXIO before the goto.
>
> Also, you don't need the ret = 0 line, it's set again
> a few lines below.
>
> I think you should end up with:
>
> ret = platform_get_irq(dev, 0);
> if (ret < 0) {
> ret = -ENXIO;
> goto unmap_io;
> }
>
> xspi->irq = ret;
>
> cheers, Joe
In that case, this should suffice,
thanks again,
Roel
---
xilinx_spi->irq is unsigned, so the test fails
Signed-off-by: Roel Kluin <12o3l-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
---
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index cf6aef3..2a471b3 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -353,11 +353,12 @@ static int __init xilinx_spi_probe(struct platform_device *dev)
goto put_master;
}
- xspi->irq = platform_get_irq(dev, 0);
- if (xspi->irq < 0) {
+ ret = platform_get_irq(dev, 0);
+ if (ret < 0) {
ret = -ENXIO;
goto unmap_io;
}
+ xspi->irq = ret;
master->bus_num = pdata->bus_num;
master->num_chipselect = pdata->num_chipselect;
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
WARNING: multiple messages have this Message-ID (diff)
From: Roel Kluin <12o3l@tiscali.nl>
To: dbrownell@users.sourceforge.net, spi-devel-general@lists.sourceforge.net
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2 v2] xilinx_spi: test below 0 on unsigned irq in xilinx_spi_probe()
Date: Thu, 24 Apr 2008 09:35:09 +0200 [thread overview]
Message-ID: <4810382D.8040405@tiscali.nl> (raw)
In-Reply-To: <480FA248.7080900@tiscali.nl>
Joe Perches wrote:
> On Wed, 2008-04-23 at 22:55 +0200, Roel Kluin wrote:
>> - xspi->irq = platform_get_irq(dev, 0);
>> - if (xspi->irq < 0) {
>> - ret = -ENXIO;
>> + ret = platform_get_irq(dev, 0);
>> + if (ret < 0)
>> goto unmap_io;
>> - }
>> +
>> + xspi->irq = ret;
>> + ret = 0;
>
> Is the only negative return from platform_get_irq ENXIO?
> I think you still need the ret = -ENXIO before the goto.
>
> Also, you don't need the ret = 0 line, it's set again
> a few lines below.
>
> I think you should end up with:
>
> ret = platform_get_irq(dev, 0);
> if (ret < 0) {
> ret = -ENXIO;
> goto unmap_io;
> }
>
> xspi->irq = ret;
>
> cheers, Joe
In that case, this should suffice,
thanks again,
Roel
---
xilinx_spi->irq is unsigned, so the test fails
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index cf6aef3..2a471b3 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -353,11 +353,12 @@ static int __init xilinx_spi_probe(struct platform_device *dev)
goto put_master;
}
- xspi->irq = platform_get_irq(dev, 0);
- if (xspi->irq < 0) {
+ ret = platform_get_irq(dev, 0);
+ if (ret < 0) {
ret = -ENXIO;
goto unmap_io;
}
+ xspi->irq = ret;
master->bus_num = pdata->bus_num;
master->num_chipselect = pdata->num_chipselect;
next prev parent reply other threads:[~2008-04-24 7:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-23 20:19 [PATCH] spi_mpc83xx: test below 0 on unsigned irq in mpc83xx_spi_probe() Roel Kluin
[not found] ` <480F99D5.7070300-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
2008-04-23 20:39 ` Kumar Gala
2008-04-23 20:39 ` Kumar Gala
2008-04-30 22:12 ` [spi-devel-general] " David Brownell
2008-04-30 22:12 ` David Brownell
2008-04-23 20:55 ` [PATCH 2/2] xilinx_spi: test below 0 on unsigned irq in xilinx_spi_probe() Roel Kluin
2008-04-23 20:55 ` Roel Kluin
[not found] ` <480FA248.7080900-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
2008-04-24 7:35 ` Roel Kluin [this message]
2008-04-24 7:35 ` [PATCH 2/2 v2] " Roel Kluin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4810382D.8040405@tiscali.nl \
--to=12o3l-iwqwacnznjzz+pzb47itoq@public.gmane.org \
--cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.