Subject: Re: [RFC PATCH net-next v5 07/25] net: dsa: qca8k: handle error with qca8k_rmw operation

From: Andrew Lunn <[email-masked]>
Date: Fri, 14 May 2021 18:43:24 +0200

> -static u32
> -qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 val)
> +static int
> +qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 write_val)
>  {
>  	struct mii_bus *bus = priv->bus;
>  	u16 r1, r2, page;
> -	u32 ret;
> +	u32 val;
> +	int ret;
>  
>  	qca8k_split_addr(reg, &r1, &r2, &page);
>  
> @@ -205,10 +206,15 @@ qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 val)
>  	if (ret < 0)
>  		goto exit;
>  
> -	ret = qca8k_mii_read32(bus, 0x10 | r2, r1);
> -	ret &= ~mask;
> -	ret |= val;
> -	qca8k_mii_write32(bus, 0x10 | r2, r1, ret);
> +	val = qca8k_mii_read32(bus, 0x10 | r2, r1);
> +	if (val < 0) {
> +		ret = val;
> +		goto exit;
> +	}
> +
> +	val &= ~mask;
> +	val |= write_val;
> +	qca8k_mii_write32(bus, 0x10 | r2, r1, val);

Does qca8k_mii_write32() not return an code?

Seems like yet another function you could modify. But i suggest you
wait, get this patchset merged first.

Reviewed-by: Andrew Lunn <[email-masked]>

    Andrew