On Tue, 30 Jun 2026 14:58:34 +0800, Pengpeng Hou <[email protected]> wrote:

Hello Pengpeng,

>
> diff --git a/drivers/gpu/drm/bridge/sii902x.c 
> b/drivers/gpu/drm/bridge/sii902x.c
> index f575b2dbe32b..1d0649611f53 100644
> --- a/drivers/gpu/drm/bridge/sii902x.c
> +++ b/drivers/gpu/drm/bridge/sii902x.c
> @@ -890,9 +890,16 @@ static int sii902x_audio_codec_init(struct sii902x 
> *sii902x,
>       }
>       codec_data.max_i2s_channels = 2 * num_lanes;
>  
> -     for (i = 0; i < num_lanes; i++)
> +     for (i = 0; i < num_lanes; i++) {
> +             if (lanes[i] >= ARRAY_SIZE(i2s_lane_id)) {
> +                     dev_err(dev, "%s: invalid i2s data lane %u\n",
> +                             __func__, lanes[i]);
> +                     return -EINVAL;
> +             }

Looks generally good, but please use dev_err_probe().

Also, even though it's done elsewhere in this file, I don't think printing
the function name would be very useful. Instead the incorrect property name
would be very useful, pointing to where the issue is, so I'd rather
suggest:

      if (...)
         return dev_err_probe(dev, -EINVAL, "invalid sil,i2s-data-lanes value 
%u\n", lanes[i]);

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Reply via email to