From: Petko Manolov <petko.manolov@konsulko.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
paskripkin@gmail.com, stable@vger.kernel.org
Subject: Re: [PATCH] net: usb: pegasus: fixes of set_register(s) return value evaluation;
Date: Fri, 20 Aug 2021 10:08:35 +0300 [thread overview]
Message-ID: <YR9U80Iv9I2SjABw@carbon> (raw)
In-Reply-To: <20210819123429.7b15f08e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On 21-08-19 12:34:29, Jakub Kicinski wrote:
> On Thu, 19 Aug 2021 12:05:39 +0300 Petko Manolov wrote:
> > - restore the behavior in enable_net_traffic() to avoid regressions - Jakub
> > Kicinski;
> > - hurried up and removed redundant assignment in pegasus_open() before yet
> > another checker complains;
> > - explicitly check for negative value in pegasus_set_wol(), even if
> > usb_control_msg_send() never return positive number we'd still be in sync
> > with the rest of the driver style;
> >
> > Fixes: 8a160e2e9aeb net: usb: pegasus: Check the return value of get_geristers() and friends;
>
> I guess this is fine but not exactly the preferred format, please see
> Submitting patches.
If the preferred format involves brackets and quotes - so be it.
> > Reported-by: Jakub Kicinski <kuba@kernel.org>
> > Signed-off-by: Petko Manolov <petko.manolov@konsulko.com>
> > ---
> > drivers/net/usb/pegasus.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> > index 652e9fcf0b77..1ef93082c772 100644
> > --- a/drivers/net/usb/pegasus.c
> > +++ b/drivers/net/usb/pegasus.c
> > @@ -446,7 +446,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
> > write_mii_word(pegasus, 0, 0x1b, &auxmode);
> > }
> >
> > - return 0;
> > + return ret;
>
> yup
>
> > fail:
> > netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__);
> > return ret;
> > @@ -835,7 +835,7 @@ static int pegasus_open(struct net_device *net)
> > if (!pegasus->rx_skb)
> > goto exit;
> >
> > - res = set_registers(pegasus, EthID, 6, net->dev_addr);
> > + set_registers(pegasus, EthID, 6, net->dev_addr);
>
> yup
>
> > usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
> > usb_rcvbulkpipe(pegasus->usb, 1),
> > @@ -932,7 +932,7 @@ pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
> > pegasus->wolopts = wol->wolopts;
> >
> > ret = set_register(pegasus, WakeupControl, reg78);
> > - if (!ret)
> > + if (ret < 0)
> > ret = device_set_wakeup_enable(&pegasus->usb->dev,
> > wol->wolopts);
>
> now this looks incorrect and unrelated to recent changes (IOW the
> commit under Fixes), please drop this chunk
It may not be related, but the change is:
a) obviously correct; and
b) in sync with the rest of 'ret' evaluations;
To be honest i do not envision usb_control_msg_send() returning positive value
anytime soon, but (ret < 0) looks "more" correct than (!ret).
Petko
next prev parent reply other threads:[~2021-08-20 7:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-19 9:05 [PATCH] net: usb: pegasus: fixes of set_register(s) return value evaluation; Petko Manolov
2021-08-19 19:34 ` Jakub Kicinski
2021-08-20 7:08 ` Petko Manolov [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-08-17 14:06 Petko Manolov
2021-08-17 16:06 ` Greg KH
2021-08-18 9:19 ` David Miller
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=YR9U80Iv9I2SjABw@carbon \
--to=petko.manolov@konsulko.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paskripkin@gmail.com \
--cc=stable@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).