linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gabor Juhos <juhosg@openwrt.org>
To: Julian Calaby <julian.calaby@gmail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, Ivo van Doorn <IvDoorn@gmail.com>,
	Gertjan van Wingerde <gwingerde@gmail.com>,
	Helmut Schaa <helmut.schaa@googlemail.com>,
	Stanislaw Gruszka <sgruszka@redhat.com>,
	Daniel Golle <dgolle@allnet.de>,
	users@rt2x00.serialmonkey.com
Subject: Re: [PATCH 1/2] rt2x00: rt2800pci: verify ioremap return value
Date: Wed, 19 Dec 2012 10:35:57 +0100	[thread overview]
Message-ID: <50D18A7D.6040001@openwrt.org> (raw)
In-Reply-To: <CAGRGNgVC46Qe0vYUYDFdjC+=ww8AL4NdHaS4wjp7w=S90ztKOA@mail.gmail.com>

2012.12.19. 0:58 keltezéssel, Julian Calaby írta:
> Hi Gabor,
> 
> One minor question:
> 
> On Wed, Dec 19, 2012 at 3:22 AM, Gabor Juhos <juhosg@openwrt.org> wrote:
>> An ioremap call is allowed to fail, however
>> the return value of that is not checked in
>> the 'rt2800pci_read_eeprom_soc' function.
>>
>> The patch adds the missing check, and makes
>> the function return an int value. The patch
>> also converts the 'rt2800_read_eeprom' and
>> 'rt2800_ops.read_eeprom' functions to return
>> an int value, so the error value can be
>> propagated up to the 'rt2800_validate_eeprom'
>> function.
>>
>> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>> ---
>>  drivers/net/wireless/rt2x00/rt2800lib.c |    5 ++++-
>>  drivers/net/wireless/rt2x00/rt2800lib.h |    6 +++---
>>  drivers/net/wireless/rt2x00/rt2800pci.c |   17 ++++++++++++-----
>>  drivers/net/wireless/rt2x00/rt2800usb.c |    4 +++-
>>  4 files changed, 22 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
>> index 9224d87..5fc16dd 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
>> @@ -970,14 +974,17 @@ static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance)
>>  /*
>>   * Device probe functions.
>>   */
>> -static void rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev)
>> +static int rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev)
>>  {
>>         if (rt2x00_is_soc(rt2x00dev))
>> -               rt2800pci_read_eeprom_soc(rt2x00dev);
>> -       else if (rt2800pci_efuse_detect(rt2x00dev))
>> +               return rt2800pci_read_eeprom_soc(rt2x00dev);
>> +
>> +       if (rt2800pci_efuse_detect(rt2x00dev))
>>                 rt2800pci_read_eeprom_efuse(rt2x00dev);
>>         else
>>                 rt2800pci_read_eeprom_pci(rt2x00dev);
> 
> Would it make any sense to have rt2800pci_read_eeprom_efuse() and
> rt2800pci_read_eeprom_pci() return a value, simply for consistency
> with rt2800pci_read_eeprom_soc()?

I wanted to keep the change as minimal as possible, but this would make sense.

> 
>> +
>> +       return 0;
>>  }
>>
>>  static const struct ieee80211_ops rt2800pci_mac80211_ops = {
>> diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
>> index 5c149b5..48de5c9 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
>> @@ -735,13 +735,15 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
>>  /*
>>   * Device probe functions.
>>   */
>> -static void rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev)
>> +static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev)
>>  {
>>         if (rt2800_efuse_detect(rt2x00dev))
>>                 rt2800_read_eeprom_efuse(rt2x00dev);
>>         else
>>                 rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
>>                                       EEPROM_SIZE);
> 
> Same here.

Yes, especially that the 'rt2x00usb_eeprom_read' function returns an int value
already.

Thank you for the review!

-Gabor


  reply	other threads:[~2012-12-19  9:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18 16:22 [PATCH 1/2] rt2x00: rt2800pci: verify ioremap return value Gabor Juhos
2012-12-18 16:22 ` [PATCH 2/2] rt2x00: rt2800pci: allow to load EEPROM data via firmware API Gabor Juhos
2012-12-18 22:22   ` [rt2x00-users] " Stanislaw Gruszka
2012-12-19  9:35     ` Gabor Juhos
2012-12-20  8:58       ` Kalle Valo
2012-12-20 11:06         ` Stanislaw Gruszka
2012-12-20 14:34           ` Gabor Juhos
2012-12-18 21:57 ` [rt2x00-users] [PATCH 1/2] rt2x00: rt2800pci: verify ioremap return value Stanislaw Gruszka
2012-12-19  9:34   ` Gabor Juhos
2012-12-18 23:58 ` Julian Calaby
2012-12-19  9:35   ` Gabor Juhos [this message]
2012-12-19 11:05 ` Jones Desougi
2012-12-19 11:59   ` Gabor Juhos
2013-01-07 20:02     ` John W. Linville
2013-01-07 20:37       ` Gabor Juhos
2013-01-07 21:08         ` John W. Linville

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=50D18A7D.6040001@openwrt.org \
    --to=juhosg@openwrt.org \
    --cc=IvDoorn@gmail.com \
    --cc=dgolle@allnet.de \
    --cc=gwingerde@gmail.com \
    --cc=helmut.schaa@googlemail.com \
    --cc=julian.calaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=sgruszka@redhat.com \
    --cc=users@rt2x00.serialmonkey.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).