netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>
Cc: Peter Korsgaard <peter@korsgaard.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: usb: dm9601: fix wrong return value in dm9601_mdio_read
Date: Tue, 27 Feb 2024 18:17:09 -0800	[thread overview]
Message-ID: <20240227181709.7159d60f@kernel.org> (raw)
In-Reply-To: <20240225-dm9601_ret_err-v1-1-02c1d959ea59@gmail.com>

On Sun, 25 Feb 2024 00:20:06 +0100 Javier Carrasco wrote:
> The MII code does not check the return value of mdio_read (among
> others), and therefore no error code should be sent. A previous fix to
> the use of an uninitialized variable propagates negative error codes,
> that might lead to wrong operations by the MII library.
> 
> An example of such issues is the use of mii_nway_restart by the dm9601
> driver. The mii_nway_restart function does not check the value returned
> by mdio_read, which in this case might be a negative number which could
> contain the exact bit the function checks (BMCR_ANENABLE = 0x1000).
> 
> Return zero in case of error, as it is common practice in users of
> mdio_read to avoid wrong uses of the return value.

A bit odd but appears to be true, so I'll apply, thank you!

Andrew, 
mii.h files seem to fall under PHYLIB in MAINTAINERS, but mii.c does
not. Is this intentional?

  parent reply	other threads:[~2024-02-28  2:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-24 23:20 [PATCH] net: usb: dm9601: fix wrong return value in dm9601_mdio_read Javier Carrasco
2024-02-27 16:09 ` Simon Horman
2024-02-27 16:53 ` Peter Korsgaard
2024-02-28  2:17 ` Jakub Kicinski [this message]
2024-02-28 15:10   ` Andrew Lunn
2024-02-28  3:20 ` patchwork-bot+netdevbpf

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=20240227181709.7159d60f@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peter@korsgaard.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).