From: Pavel Skripkin <paskripkin@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
Petko Manolov <petko.manolov@konsulko.com>
Cc: netdev@vger.kernel.org, stable@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] net: usb: pegasus: ignore the return value from set_registers();
Date: Sat, 14 Aug 2021 16:18:58 +0300 [thread overview]
Message-ID: <9688d41f-a9f0-47f3-5f51-5c7981f5337e@gmail.com> (raw)
In-Reply-To: <20210813162439.1779bf63@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On 8/14/21 2:24 AM, Jakub Kicinski wrote:
> On Thu, 12 Aug 2021 11:23:51 +0300 Petko Manolov wrote:
>> The return value need to be either ignored or acted upon, otherwise 'deadstore'
>> clang check would yell at us. I think it's better to just ignore what this
>> particular call of set_registers() returns. The adapter defaults are sane and
>> it would be operational even if the register write fail.
>>
>> Signed-off-by: Petko Manolov <petko.manolov@konsulko.com>
>> ---
>> drivers/net/usb/pegasus.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
>> index 652e9fcf0b77..49cfc720d78f 100644
>> --- a/drivers/net/usb/pegasus.c
>> +++ b/drivers/net/usb/pegasus.c
>> @@ -433,7 +433,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
>> data[2] = loopback ? 0x09 : 0x01;
>>
>> memcpy(pegasus->eth_regs, data, sizeof(data));
>> - ret = set_registers(pegasus, EthCtrl0, 3, data);
>> + set_registers(pegasus, EthCtrl0, 3, data);
>>
>> if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
>> usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS2 ||
>
> This one is not added by the recent changes as I initially thought,
> the driver has always checked this return value. The recent changes
> did this:
>
> ret = set_registers(pegasus, EthCtrl0, 3, data);
>
> if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
> usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS2 ||
> usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) {
> u16 auxmode;
> - read_mii_word(pegasus, 0, 0x1b, &auxmode);
> + ret = read_mii_word(pegasus, 0, 0x1b, &auxmode);
> + if (ret < 0)
> + goto fail;
> auxmode |= 4;
> write_mii_word(pegasus, 0, 0x1b, &auxmode);
> }
>
> + return 0;
> +fail:
> + netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__);
> return ret;
> }
>
> now the return value of set_registeres() is ignored.
>
> Seems like a better fix would be to bring back the error checking,
> why not?
>
> Please remember to add a fixes tag.
>
Hi, Jakub!
I've suggested to handle this error, but Petko said that device won't
stop working, it will just get in non-optimal state.
https://lore.kernel.org/lkml/YRF1t5kx6hTrv5LC@carbon/
With regards,
Pavel Skripkin
next prev parent reply other threads:[~2021-08-14 13:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 8:23 [PATCH] net: usb: pegasus: ignore the return value from set_registers(); Petko Manolov
2021-08-13 23:24 ` Jakub Kicinski
2021-08-14 13:18 ` Pavel Skripkin [this message]
2021-08-15 8:54 ` Petko Manolov
2021-08-16 14:06 ` Jakub Kicinski
2021-08-16 19:14 ` Petko Manolov
2021-08-16 20:18 ` Jakub Kicinski
2021-08-17 14:11 ` Petko Manolov
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=9688d41f-a9f0-47f3-5f51-5c7981f5337e@gmail.com \
--to=paskripkin@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=petko.manolov@konsulko.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