From: Jakub Kicinski <kuba@kernel.org>
To: David Kahurani <k.kahurani@gmail.com>
Cc: netdev@vger.kernel.org,
syzbot+d3dbdf31fbe9d8f5f311@syzkaller.appspotmail.com,
davem@davemloft.net, jgg@ziepe.ca, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, phil@philpotter.co.uk,
syzkaller-bugs@googlegroups.com, arnd@arndb.de,
dan.carpenter@oracle.com
Subject: Re: [PATCH] net: ax88179: add proper error handling of usb read errors
Date: Mon, 16 May 2022 12:31:01 -0700 [thread overview]
Message-ID: <20220516123101.467ad206@kernel.org> (raw)
In-Reply-To: <20220514133234.33796-1-k.kahurani@gmail.com>
On Sat, 14 May 2022 16:32:34 +0300 David Kahurani wrote:
> - ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD,
> - 1, 1, &buf);
> + ret = ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD,
> + 1, 1, &buf);
> + if (ret) {
> + netdev_dbg(dev->net,
> + "Failed to read SROM_CMD: %d\n",
> + ret);
> + return ret;
> + }
>
> if (time_after(jiffies, jtimeout))
> return -EINVAL;
>
> } while (buf & EEP_BUSY);
I agree with Pavel, this seems unnecessarily strict. If the error is
not ENODEV we can keep looping.
> @@ -1581,7 +1731,13 @@ static int ax88179_link_reset(struct usbnet *dev)
> &ax179_data->rxctl);
>
> /*link up, check the usb device control TX FIFO full or empty*/
> - ax88179_read_cmd(dev, 0x81, 0x8c, 0, 4, &tmp32);
> + ret = ax88179_read_cmd(dev, 0x81, 0x8c, 0, 4, &tmp32);
> +
> + if (ret) {
> + netdev_dbg(dev->net, "Failed to read TX FIFO: %d\n",
> + ret);
> + return ret;
> + }
Please don't add any empty lines within the error checking.
Empty lines are supposed to separate logically separate blocks of code.
Error checking is very much logically part of the call. And no empty
line betwee netdev_dbg() and return ret; either. In this submission you
have all possible configurations of having or not having empty lines
before the if or before the return. None of them should be there, and
please be consistent.
next prev parent reply other threads:[~2022-05-16 19:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-14 13:32 [PATCH] net: ax88179: add proper error handling of usb read errors David Kahurani
2022-05-14 16:51 ` Pavel Skripkin
2022-05-14 18:54 ` Dan Carpenter
2022-05-14 18:57 ` Pavel Skripkin
2022-05-16 19:31 ` Jakub Kicinski [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-04-16 7:48 David Kahurani
2022-04-16 11:05 ` Pavel Skripkin
2022-04-16 11:10 ` Pavel Skripkin
2022-04-16 11:49 ` David Kahurani
2022-04-16 11:53 ` Pavel Skripkin
2022-04-16 11:57 ` Pavel Skripkin
2022-04-19 13:41 ` Paolo Abeni
2022-04-04 15:10 David Kahurani
2022-04-04 15:31 ` Dan Carpenter
2022-04-13 12:36 ` David Kahurani
2022-04-13 15:32 ` Dan Carpenter
2022-04-14 7:31 ` Oliver Neukum
2022-04-14 8:21 ` Dan Carpenter
2022-04-14 9:13 ` Oliver Neukum
2022-04-04 16:50 ` Pavel Skripkin
2022-04-11 15:11 ` Andy Shevchenko
2022-04-05 9:44 ` Paolo Abeni
2022-04-05 20:44 ` kernel test robot
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=20220516123101.467ad206@kernel.org \
--to=kuba@kernel.org \
--cc=arnd@arndb.de \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=jgg@ziepe.ca \
--cc=k.kahurani@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=phil@philpotter.co.uk \
--cc=syzbot+d3dbdf31fbe9d8f5f311@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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).