Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Missing error check causes genuinely malformed 'data-lanes' property 
to be silently ignored.
--

--- Patch [3]: [PATCH v6 3/3] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes 
support ---
commit b4313ac661e9afa3be192ed6d9fd4791e5f7c33a
Author: Wojciech Dubowik <[email protected]>

drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support

This commit adds support for parsing an optional "data-lanes" property to
configure the ti-sn65dsi83 chip when LVDS output lanes have been reversed, 
allowing it to program the corresponding hardware registers accordingly.

> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c 
> b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> index 1869ebe13366c..e1b6e22bed359 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c

[ ... ]

> @@ -845,6 +863,19 @@ static int sn65dsi83_parse_lvds_endpoint(struct 
> sn65dsi83 *ctx, int channel)
>       else
>               return -EINVAL;
>  
> +     ret_data = of_property_read_u32_array(endpoint, "data-lanes", 
> data_lanes,
> +                     ARRAY_SIZE(data_lanes));
> +     if (!ret_data) {
> +             if (memcmp(data_lanes,
> +                             
> supported_data_lane_mapping[LANE_MAPPING_REVERSE],
> +                             sizeof(data_lanes)) == 0)
> +                     ctx->lvds_reverse_lanes_conf[channel] = true;
> +             else if (memcmp(data_lanes,
> +                        supported_data_lane_mapping[LANE_MAPPING_NORMAL],
> +                        sizeof(data_lanes)) != 0)
> +                     return dev_err_probe(dev, -EINVAL, "invalid data lanes 
> mapping\n");
> +     }
> +
>       ret_data = of_property_read_u32_array(endpoint, 
> "ti,lvds-vod-swing-data-microvolt",
>                                       lvds_vod_swing_data, 
> ARRAY_SIZE(lvds_vod_swing_data));

[Severity: Medium]
If the "data-lanes" property exists but is malformed (for example, containing an
incorrect number of elements and returning -EOVERFLOW), ret_data will be
non-zero and the error is ignored. The ret_data variable is then immediately
overwritten by the next property read.

Should we check for error codes other than -EINVAL (which indicates the optional
property is absent) and return an error, rather than silently ignoring malformed
device tree properties?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to