Re: [RFC PATCH net-next v4 08/28] net: dsa: qca8k: handle error with qca8k_read operation
From: Andrew Lunn
Date: Sat May 08 2021 - 13:46:15 EST
> static int
> qca8k_fdb_next(struct qca8k_priv *priv, struct qca8k_fdb *fdb, int port)
> {
> - int ret;
> + int ret, ret_read;
>
> qca8k_fdb_write(priv, fdb->vid, fdb->port_mask, fdb->mac, fdb->aging);
> ret = qca8k_fdb_access(priv, QCA8K_FDB_NEXT, port);
> - if (ret >= 0)
> - qca8k_fdb_read(priv, fdb);
> + if (ret >= 0) {
> + ret_read = qca8k_fdb_read(priv, fdb);
> + if (ret_read < 0)
> + return ret_read;
> + }
This is O.K, but it is a bit of an odd structure. How about
qca8k_fdb_write(priv, fdb->vid, fdb->port_mask, fdb->mac, fdb->aging);
ret = qca8k_fdb_access(priv, QCA8K_FDB_NEXT, port);
if (ret < 0)
return ret;
return qca8k_fdb_read(priv, fdb);
}
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Andrew