Re: [RFC Patch net-next v2 3/9] net: dsa: microchip: perform the compatibility check for dev probed

From: Vladimir Oltean
Date: Mon May 16 2022 - 07:08:19 EST


On Fri, May 13, 2022 at 03:52:13PM +0530, Arun Ramadoss wrote:
> +static int ksz_check_device_id(struct ksz_device *dev)
> +{
> + const struct ksz_chip_data *dt_chip_data;
> +
> + dt_chip_data = of_device_get_match_data(dev->dev);

And one other comment. You haven't converted ksz8863_smi.c to put
anything in struct of_device_id :: data, so that driver will dereference
NULL here.

> +
> + /* Check for Device Tree and Chip ID */
> + if (dt_chip_data->chip_id != dev->chip_id) {
> + dev_err(dev->dev,
> + "Device tree specifies chip %s but found %s, please fix it!\n",
> + dt_chip_data->dev_name, dev->info->dev_name);
> + return -ENODEV;
> + }
> +
> + return 0;
> +}