All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Ivo Van Doorn <ivdoorn@gmail.com>
Cc: linux-wireless@vger.kernel.org,
	Gertjan van Wingerde <gwingerde@gmail.com>
Subject: Re: [RFC] rt2x00: check return from dma_map_single
Date: Wed, 3 Oct 2012 09:08:03 -0400	[thread overview]
Message-ID: <20121003130803.GA2030@tuxdriver.com> (raw)
In-Reply-To: <CAOZOX0URb51i=6wko1MJVsi7du2kyYo9W=LLZSpH7Svh9BgAMw@mail.gmail.com>

On Wed, Oct 03, 2012 at 11:33:25AM +0200, Ivo Van Doorn wrote:
> Hi,
> 
> On Tue, Oct 2, 2012 at 8:21 PM, John W. Linville <linville@tuxdriver.com> wrote:
> > From: "John W. Linville" <linville@tuxdriver.com>
> >
> > dma_map_single can fail, so it's return value needs to be checked and
> > handled accordingly.  Failure to do so is akin to failing to check the
> > return from a kmalloc.
> >
> > http://linuxdriverproject.org/mediawiki/index.php/DMA_Mapping_Error_Analysis
> >
> > Signed-off-by: John W. Linville <linville@tuxdriver.com>
> > Cc: Gertjan van Wingerde <gwingerde@gmail.com>
> > Cc: Ivo van Doorn <IvDoorn@gmail.com>
> > ---
> > Compile tested only...can the experts take a look at how the failures
> > are handled?
> 
> <snip>
> 
> > diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
> > index 0751b35..50ff18d 100644
> > --- a/drivers/net/wireless/rt2x00/rt2x00.h
> > +++ b/drivers/net/wireless/rt2x00/rt2x00.h
> > @@ -605,8 +605,8 @@ struct rt2x00lib_ops {
> >                                struct txentry_desc *txdesc);
> >         void (*write_tx_data) (struct queue_entry *entry,
> >                                struct txentry_desc *txdesc);
> > -       void (*write_beacon) (struct queue_entry *entry,
> > -                             struct txentry_desc *txdesc);
> > +       int (*write_beacon) (struct queue_entry *entry,
> > +                            struct txentry_desc *txdesc);
> >         void (*clear_beacon) (struct queue_entry *entry);
> >         int (*get_tx_data_len) (struct queue_entry *entry);
> 
> The only thing I am missing in the commit, is the check for
> the return value when write_beacon is being called.

D'oh!!  I got in a hurry...that's a lot of trouble to add a return
value just to not check it! :-)

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  reply	other threads:[~2012-10-03 13:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02 18:21 [RFC] rt2x00: check return from dma_map_single John W. Linville
2012-10-03  9:33 ` Ivo Van Doorn
2012-10-03 13:08   ` John W. Linville [this message]
2012-10-03 10:03 ` Gertjan van Wingerde
2012-10-03 19:32 ` [RFC v2] " John W. Linville
2012-10-04 18:57   ` Ivo Van Doorn

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=20121003130803.GA2030@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=gwingerde@gmail.com \
    --cc=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.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.