linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luciano Coelho <coelho@ti.com>
To: Kalle Valo <kvalo@adurom.com>
Cc: Eliad Peller <eliad@wizery.com>,
	eyal@wizery.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2 5/7] wl12xx: add RX data filter ACX commands
Date: Mon, 06 Feb 2012 16:32:14 +0200	[thread overview]
Message-ID: <1328538734.7324.139.camel@cumari> (raw)
In-Reply-To: <877h00cay9.fsf@purkki.adurom.net>

On Mon, 2012-02-06 at 16:07 +0200, Kalle Valo wrote: 
> Luciano Coelho <coelho@ti.com> writes:
> 
> >> +	if (index >= WL1271_MAX_RX_DATA_FILTERS) {
> >> +		wl1271_warning("acx_set_rx_data_filter: invalid filter idx(%d)",
> >> +			       index);
> >> +		return -EINVAL;
> >> +	}
> >
> > Should we use BUG_ON instead? This is only used internally in the
> > driver, so if it get here, it's a bug.  And if the filters come from
> > userspace, we should validate them before continuing anyway.
> 
> BUG_ON() is evil and wireless drivers should really not use it,
> WARN_ON_ONCE() and return with an error is much more user friendly.

Yeah, BUG_ON() is evil, but sometimes it can be good to have.  I don't
agree with "wireless drivers should really not use it".  There are 181
occurrences in wireless-testing/master right now[1].  I'm not saying
this measure is either accurate or an excuse to use it where we
shouldn't, but it shows that it really has widespread usage in wireless
drivers.

My point was that this can only happen very early, when the driver is
being initialized.  But this is not exactly this case, it only happens
when we suspend or resume, so you're right here.

Maybe in this case we should check with a BUILD_BUG_ON somehow.

And actually, I nacked this part of the patchset, they definitely need
to be reworked.  Eliad already sent v2 of the first 4, leaving 5/6/7
out.

In any case, thanks a lot for your comment, Kalle! :)


[1]
luca@cumari:~/kernel/wl12xx$ find drivers/net/wireless/ -name '*.[ch]' -exec grep -e '\<BUG_ON\>' {} \;|wc -l
181


-- 
Cheers,
Luca.


  reply	other threads:[~2012-02-06 14:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 14:44 [PATCH v2 0/7] wl12xx: add some psm/suspend features Eliad Peller
2012-01-31 14:44 ` [PATCH v2 1/7] wl12xx: Set different wake up conditions in case of suspend Eliad Peller
2012-01-31 14:44 ` [PATCH v2 2/7] wl12xx: add suspend_listen_interval debugfs file Eliad Peller
2012-01-31 14:44 ` [PATCH v2 3/7] wl12xx: add forced_ps mode Eliad Peller
2012-02-02  7:43   ` Luciano Coelho
2012-01-31 14:44 ` [PATCH v2 4/7] wl12xx: add forced_ps debugfs file Eliad Peller
2012-02-02  7:44   ` Luciano Coelho
2012-02-02  8:09     ` Luciano Coelho
2012-01-31 14:44 ` [PATCH v2 5/7] wl12xx: add RX data filter ACX commands Eliad Peller
2012-02-02  8:23   ` Luciano Coelho
2012-02-06 14:07     ` Kalle Valo
2012-02-06 14:32       ` Luciano Coelho [this message]
2012-02-07 16:05         ` Kalle Valo
2012-02-07 16:11           ` Luciano Coelho
2012-01-31 14:44 ` [PATCH v2 6/7] wl12xx: add RX data filters management functions Eliad Peller
2012-02-02  8:39   ` Luciano Coelho
2012-01-31 14:44 ` [PATCH v2 7/7] wl12xx: support wowlan wakeup patterns Eliad Peller
2012-02-02  9:31 ` [PATCH v2 0/7] wl12xx: add some psm/suspend features Luciano Coelho
2012-02-02  9:45   ` Eliad Peller

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=1328538734.7324.139.camel@cumari \
    --to=coelho@ti.com \
    --cc=eliad@wizery.com \
    --cc=eyal@wizery.com \
    --cc=kvalo@adurom.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 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).