Re: [PATCH 05/14] drivers: net: dsa: qca8k: add support for qca8327 switch

From: Andrew Lunn
Date: Fri Apr 23 2021 - 08:42:12 EST


> @@ -1467,11 +1468,16 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
> gpiod_set_value_cansleep(priv->reset_gpio, 0);
> }
>
> + /* get the switches ID from the compatible */
> + data = of_device_get_match_data(&mdiodev->dev);
> + if (!data)
> + return -ENODEV;
> +
> /* read the switches ID register */
> id = qca8k_read(priv, QCA8K_REG_MASK_CTRL);
> id >>= QCA8K_MASK_CTRL_ID_S;
> id &= QCA8K_MASK_CTRL_ID_M;
> - if (id != QCA8K_ID_QCA8337)
> + if (id != data->id)
> return -ENODEV;

It is useful to print an error message here: Found X, expected
Y. Gives the DT writer an idea what they did wrong.

Andrew