public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine•com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux•org.uk>
Cc: Andrew Lunn <andrew@lunn•ch>,
	Heiner Kallweit <hkallweit1@gmail•com>,
	Alexander Couzens <lynxis@fe80•eu>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora•com>,
	Cc@web•codeaurora.org:  Claudiu Beznea
	<claudiu.beznea@microchip•com>,
	Daniel Golle <daniel@makrotopia•org>,
	Daniel Machon <daniel.machon@microchip•com>,
	"David S. Miller" <davem@davemloft•net>,
	DENG Qingfang <dqfext@gmail•com>,
	Eric Dumazet <edumazet@google•com>,
	Florian Fainelli <f.fainelli@gmail•com>,
	Horatiu Vultur <horatiu.vultur@microchip•com>,
	Ioana Ciornei <ioana.ciornei@nxp•com>,
	Jakub Kicinski <kuba@kernel•org>,
	Jose Abreu <Jose.Abreu@synopsys•com>,
	Landen Chao <Landen.Chao@mediatek•com>,
	Lars Povlsen <lars.povlsen@microchip•com>,
	linux-arm-kernel@lists•infradead.org,
	linux-mediatek@lists•infradead.org,
	Madalin Bucur <madalin.bucur@nxp•com>,
	Marcin Wojtas <mw@semihalf•com>,
	Matthias Brugger <matthias.bgg@gmail•com>,
	Michal Simek <michal.simek@amd•com>,
	netdev@vger•kernel.org,
	Nicolas Ferre <nicolas.ferre@microchip•com>,
	Paolo Abeni <pabeni@redhat•com>,
	Radhey Shyam Pandey <radhey.shyam.pandey@xilinx•com>,
	Sean Anderson <sean.anderson@seco•com>,
	Sean Wang <sean.wang@mediatek•com>,
	Steen Hegelund <Steen.Hegelund@microchip•com>,
	Taras Chornyi <taras.chornyi@plvision•eu>,
	Thomas Petazzoni <thomas.petazzoni@bootlin•com>,
	UNGLinuxDriver@microchip•com, Vladimir Oltean <olteanv@gmail•com>
Subject: Re: [PATCH RFC net-next 01/15] net: phylink: add PCS negotiation mode
Date: Tue, 13 Jun 2023 17:55:11 +0200	[thread overview]
Message-ID: <ZIiRX5+sdYUkBVxu@corigine.com> (raw)
In-Reply-To: <E1q959I-00EBvY-Oq@rmk-PC.armlinux.org.uk>

On Tue, Jun 13, 2023 at 03:37:32PM +0100, Russell King (Oracle) wrote:

...

> @@ -1149,12 +1159,20 @@ static int phylink_change_inband_advert(struct phylink *pl)

Hi Russell,

A bit further above in this function is the following condition:

        if (!pl->pcs && pl->config->legacy_pre_march2020) {
		...
		return 0;
	}

So it is anticipated that pl->pcs may be NULL,
but the function will continue unless
pl->config->legacy_pre_march2020 is true.


>  		    __ETHTOOL_LINK_MODE_MASK_NBITS, pl->link_config.advertising,
>  		    pl->link_config.pause);
>  
> +	/* Recompute the PCS neg mode */
> +	pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode,
> +					pl->link_config.interface,
> +					pl->link_config.advertising);

	nit: this indentation is incorrect.

> +
> +	neg_mode = pl->cur_link_an_mode;
> +	if (pl->pcs->neg_mode)

But Smatch flags that here pl->pcs is dereferenced unconditionally.

> +		neg_mode = pl->pcs_neg_mode;
> +
>  	/* Modern PCS-based method; update the advert at the PCS, and
>  	 * restart negotiation if the pcs_config() helper indicates that
>  	 * the programmed advertisement has changed.
>  	 */
> -	ret = phylink_pcs_config(pl->pcs, pl->cur_link_an_mode,
> -				 &pl->link_config,
> +	ret = phylink_pcs_config(pl->pcs, neg_mode, &pl->link_config,
>  				 !!(pl->link_config.pause & MLO_PAUSE_AN));
>  	if (ret < 0)
>  		return ret;

  reply	other threads:[~2023-06-13 15:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 14:36 [PATCH RFC 0/15] Add and use helper for PCS negotiation modes Russell King (Oracle)
2023-06-13 14:37 ` [PATCH RFC net-next 01/15] net: phylink: add PCS negotiation mode Russell King (Oracle)
2023-06-13 15:55   ` Simon Horman [this message]
2023-06-13 14:37 ` [PATCH RFC net-next 02/15] net: phylink: convert phylink_mii_c22_pcs_config() to neg_mode Russell King (Oracle)
2023-06-13 14:37 ` [PATCH RFC net-next 03/15] net: phylink: pass neg_mode into phylink_mii_c22_pcs_config() Russell King (Oracle)
2023-06-13 14:37 ` [PATCH RFC net-next 04/15] net: pcs: xpcs: update PCS driver to use neg_mode Russell King (Oracle)
2023-06-13 14:37 ` [PATCH RFC net-next 05/15] net: pcs: lynxi: " Russell King (Oracle)
2023-06-13 14:37 ` [PATCH RFC net-next 06/15] net: pcs: lynx: " Russell King (Oracle)
2023-06-13 14:38 ` [PATCH RFC net-next 07/15] net: lan966x: " Russell King (Oracle)
2023-06-13 14:38 ` [PATCH RFC net-next 08/15] net: mvneta: " Russell King (Oracle)
2023-06-13 14:38 ` [PATCH RFC net-next 09/15] net: mvpp2: " Russell King (Oracle)
2023-06-13 14:38 ` [PATCH RFC net-next 10/15] net: prestera: " Russell King (Oracle)
2023-06-13 16:17   ` [EXT] " Elad Nachman
2023-06-13 14:38 ` [PATCH RFC net-next 11/15] net: qca8k: " Russell King (Oracle)
2023-06-13 14:38 ` [PATCH RFC net-next 12/15] net: sparx5: " Russell King (Oracle)
2023-06-13 14:38 ` [PATCH RFC net-next 13/15] net: dsa: b53: " Russell King (Oracle)
2023-06-13 14:38 ` [PATCH RFC net-next 14/15] net: dsa: mt7530: " Russell King (Oracle)
2023-06-13 14:38 ` [PATCH RFC net-next 15/15] net: macb: " Russell King (Oracle)

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=ZIiRX5+sdYUkBVxu@corigine.com \
    --to=simon.horman@corigine$(echo .)com \
    --cc=Cc@web$(echo .)codeaurora.org \
    --cc=andrew@lunn$(echo .)ch \
    --cc=angelogioacchino.delregno@collabora$(echo .)com \
    --cc=hkallweit1@gmail$(echo .)com \
    --cc=lynxis@fe80$(echo .)eu \
    --cc=rmk+kernel@armlinux$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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