From: Simon Horman <horms@kernel.org>
To: "Kamil Horák - 2N" <kamilh@axis.com>
Cc: florian.fainelli@broadcom.com,
bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch,
hkallweit1@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/3] net: phy: bcm-phy-lib: Implement BroadR-Reach link modes
Date: Wed, 8 May 2024 08:39:52 +0100 [thread overview]
Message-ID: <20240508073952.GL15955@kernel.org> (raw)
In-Reply-To: <20240506144015.2409715-4-kamilh@axis.com>
On Mon, May 06, 2024 at 04:40:15PM +0200, Kamil Horák - 2N wrote:
> Implement single-pair BroadR-Reach modes on bcm5481x PHY by Broadcom.
> Create set of functions alternative to IEEE 802.3 to handle configuration
> of these modes on compatible Broadcom PHYs.
>
> Signed-off-by: Kamil Horák - 2N <kamilh@axis.com>
Hi Kamil,
Some minor feedback from my side.
...
> diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c
...
> +/**
> + * bcm_linkmode_adv_to_mii_adv_t
> + * @advertising: the linkmode advertisement settings
> + *
> + * A small helper function that translates linkmode advertisement
> + * settings to phy autonegotiation advertisements for the
> + * MII_BCM54XX_LREANAA register.
Please consider including a Return: section in the Kernel doc.
Flagged by ./scripts/kernel-doc -Wall -none
> + */
> +static inline u32 bcm_linkmode_adv_to_mii_adv_t(unsigned long *advertising)
...
> diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
...
> +static int bcm_read_master_slave(struct phy_device *phydev)
> +{
> + int cfg, state;
> + int val;
> +
> + /* In BroadR-Reach mode we are always capable of master-slave
> + * and there is no preferred master or slave configuration
> + */
> + phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN;
> + phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
> +
> + val = phy_read(phydev, MII_BCM54XX_LRECR);
> + if (val < 0)
> + return val;
> +
> + if ((val & LRECR_LDSEN) == 0) {
> + if (val & LRECR_MASTER)
> + cfg = MASTER_SLAVE_CFG_MASTER_FORCE;
> + else
> + cfg = MASTER_SLAVE_CFG_SLAVE_FORCE;
> + }
> +
> + val = phy_read(phydev, MII_BCM54XX_LRELDSE);
> + if (val < 0)
> + return val;
> +
> + if (val & LDSE_MASTER)
> + state = MASTER_SLAVE_STATE_MASTER;
> + else
> + state = MASTER_SLAVE_STATE_SLAVE;
> +
> + phydev->master_slave_get = cfg;
Perhaps it is not possible, but it appears that if the
((val & LRECR_LDSEN) == 0) condition above is not met then
cfg is used uninitialised here.
Flagged by Smatch.
> + phydev->master_slave_state = state;
> +
> + return 0;
> +}
...
prev parent reply other threads:[~2024-05-08 7:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 14:40 [PATCH v3 0/3] net: phy: bcm5481x: add support for BroadR-Reach mode Kamil Horák - 2N
2024-05-06 14:40 ` [PATCH v3 1/3] net: phy: bcm54811: New link mode for BroadR-Reach Kamil Horák - 2N
2024-05-06 19:14 ` Andrew Lunn
2024-05-22 7:57 ` Kamil Horák, 2N
2024-05-06 19:27 ` Florian Fainelli
2024-05-06 14:40 ` [PATCH v3 2/3] net: phy: bcm54811: Add LRE registers definitions Kamil Horák - 2N
2024-05-06 19:25 ` Florian Fainelli
2024-05-06 19:26 ` Andrew Lunn
2024-05-06 14:40 ` [PATCH v3 3/3] net: phy: bcm-phy-lib: Implement BroadR-Reach link modes Kamil Horák - 2N
2024-05-06 19:35 ` Andrew Lunn
2024-05-06 20:14 ` Christophe JAILLET
2024-05-08 7:39 ` Simon Horman [this message]
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=20240508073952.GL15955@kernel.org \
--to=horms@kernel.org \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=kamilh@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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