RE: [EXTERNAL] [PATCH] net: atlantic: Add error handling in set_raw_ingress_record()
From: Igor Russkikh
Date: Mon May 19 2025 - 07:08:32 EST
> The set_raw_ingress_record() calls aq_mss_mdio_write() but does not check the return value. A proper implementation can be found in get_raw_ingress_record(). Add error handling for aq_mss_mdio_write(). If the write fails, return immediately.
>
> The set_raw_ingress_record() calls aq_mss_mdio_write() but does not
> check the return value. A proper implementation can be found in
> get_raw_ingress_record().
>
> Add error handling for aq_mss_mdio_write(). If the write fails,
> return immediately.
Hi Wentao,
aq_mss_mdio_write is practically always returns success as of today.
So introducing your change without actually making aq_mss_mdio_write and aq_mdio_write_word returning error code is useless IMHO.
> + ret = aq_mss_mdio_write(hw, MDIO_MMD_VEND1,
> + MSS_INGRESS_LUT_ADDR_CTL_REGISTER_ADDR,
> + lut_sel_reg.word_0);
> + if (unlikely(ret))
> + return ret;
> + ret = aq_mss_mdio_write(hw, MDIO_MMD_VEND1, MSS_INGRESS_LUT_CTL_REGISTER_ADDR,
> + lut_op_reg.word_0);
> + if (unlikely(ret))
> + return ret;
You introduce checks only for the two last operations, but not for many others above them. Any reason to do so?
Overall, I think if you want to improve in this direction:
1) we should propagate error conditions from aq_mdio_write_word
2) all instances of aq_mss_mdio_write should have checks for err condition
3) this is not actually a bug, but improvement - therefore make sense to post this into net-next.
Regards,
Igor