Re: [PATCH net-next v2 6/9] net: dsa: microchip: dcb: add special handling for KSZ88X3 family

From: Simon Horman
Date: Fri Apr 05 2024 - 14:19:45 EST


On Wed, Apr 03, 2024 at 11:29:02AM +0200, Oleksij Rempel wrote:

..

> diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
> index 0ead198bacb2c..a520352d5b93e 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -179,6 +179,21 @@ static int ksz8_port_queue_split(struct ksz_device *dev, int port, int queues)
> return ksz_prmw8(dev, port, reg_2q, mask_2q, data_2q);
> }
>
> +int ksz8_all_queues_split(struct ksz_device *dev, int queues)
> +{
> + struct dsa_switch *ds = dev->ds;
> + const struct dsa_port *dp;
> + int ret;
> +
> + dsa_switch_for_each_port(dp, ds) {
> + ret = ksz8_port_queue_split(dev, dp->index, queues);
> + if (ret)
> + return ret;
> + }
> +
> + return ret;

nit: Probably it can't occur, but if dsa_switch_for_each_port() iterates
zero times then ret is used uninitialised here.

In any case, perhaps it is slightly nicer to reduce the scope
of ret to inside the loop, and simply return 0 here.

> +}
> +
> void ksz8_r_mib_cnt(struct ksz_device *dev, int port, u16 addr, u64 *cnt)
> {
> const u32 *masks;

..