From: Larry Finger <Larry.Finger@lwfinger.net>
To: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Cc: John W Linville <linville@tuxdriver.com>,
Hin-Tak Leung <htl10@users.sourceforge.net>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH] rtl8187: Use usb anchor facilities to manage urbs
Date: Tue, 09 Dec 2008 21:06:34 -0600 [thread overview]
Message-ID: <493F323A.2000609@lwfinger.net> (raw)
In-Reply-To: <200812091706.19994.herton@mandriva.com.br>
Herton Ronaldo Krzesinski wrote:
> Em Ter=E7a 09 Dezembro 2008, =E0s 14:33:29, Larry Finger escreveu:
>=20
> Hi, I looked at the patch and also the discussion on LKML about the p=
54usb,=20
> just reading the patch now spotted some minor things, see below. Othe=
rwise=20
> everything else looks fine.
--snip--
>> if (unlikely(!skb)) {
>> - usb_free_urb(urb);
>> /* TODO check rx queue length and refill *somewhere* */
>> return;
>> }
>=20
> May be remove { } ? Probably checkpatch.pl didn't spot this because o=
f the=20
> comment using one line, but if it's allowed to keep {} in this case b=
ecause of=20
> the comment no problem.
I don't know what policy is for this, but I removed the {} even though
checkpatch didn't flag it.
>> @@ -373,24 +373,30 @@ static void rtl8187_rx_cb(struct urb *ur
>> urb->context =3D skb;
>> skb_queue_tail(&priv->rx_queue, skb);
>>
>> - usb_submit_urb(urb, GFP_ATOMIC);
>> + usb_anchor_urb(urb, &priv->anchored);
>> + if (usb_submit_urb(urb, GFP_ATOMIC))
>> + usb_unanchor_urb(urb);
>=20
> may be we should also skb_unlink and dev_kfree_skb_irq skb here like =
on=20
> p54usb? although it should be freed anyway later on rtl8187_stop
Done. I think the whole error return philosophy in rtl8187 needs some c=
hecking.
There are a number of routines, such as this one, that detect an error =
but never
report it anywhere. That seems wrong.
>> }
>>
>> static int rtl8187_init_urbs(struct ieee80211_hw *dev)
>> {
>> struct rtl8187_priv *priv =3D dev->priv;
>> - struct urb *entry;
>> + struct urb *entry =3D NULL;
>> struct sk_buff *skb;
>> struct rtl8187_rx_info *info;
>> + int ret =3D 0;
>>
>> while (skb_queue_len(&priv->rx_queue) < 8) {
>> skb =3D __dev_alloc_skb(RTL8187_MAX_RX, GFP_KERNEL);
>> - if (!skb)
>> - break;
>> + if (!skb) {
>> + ret =3D -ENOMEM;
>> + goto err;
>> + }
>> entry =3D usb_alloc_urb(0, GFP_KERNEL);
>> if (!entry) {
>> kfree_skb(skb);
>=20
> kfree_skb is also called after err: too now.
=46ixed.
>> - break;
>> + ret =3D -ENOMEM;
>> + goto err;
>> }
--snip--
>> @@ -415,7 +433,6 @@ static void rtl8187b_status_cb(struct ur
>> unsigned int cmd_type;
>>
>> if (unlikely(urb->status)) {
>> - usb_free_urb(urb);
>> return;
>> }
>=20
> remove { }
Done. I wonder why checkpatch didn't complain here. I guess it doesn't =
handle
the case where the patch changes a 2-line if clause into a one-liner.
Thanks for the review.
Larry
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2008-12-10 3:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 16:33 [PATCH] rtl8187: Use usb anchor facilities to manage urbs Larry Finger
2008-12-09 19:06 ` Herton Ronaldo Krzesinski
2008-12-10 3:06 ` Larry Finger [this message]
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=493F323A.2000609@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=herton@mandriva.com.br \
--cc=htl10@users.sourceforge.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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).