[PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis
Adrien Grassein
adrien.grassein at gmail.com
Wed Mar 31 10:42:39 UTC 2021
Le mer. 31 mars 2021 à 12:29, Dan Carpenter <dan.carpenter at oracle.com> a écrit :
>
> On Wed, Mar 31, 2021 at 11:38:22AM +0200, Adrien Grassein wrote:
> > Some issues where found during static analysis of this driver.
> >
> > Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
> > Suggested-by: Dan Carpenter <dan.carpenter at oracle.com>
> > Signed-off-by: Adrien Grassein <adrien.grassein at gmail.com>
> > ---
> > drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 ++++++++++++--------
> > 1 file changed, 12 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > index 61491615bad0..9a5a19655362 100644
> > --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > @@ -635,13 +635,15 @@ static int lt8912_parse_dt(struct lt8912 *lt)
> > lt->gp_reset = gp_reset;
> >
> > endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
> > - if (IS_ERR(endpoint)) {
> > - ret = PTR_ERR(endpoint);
> > - goto end;
> > - }
> > + if (!endpoint)
> > + return -ENODEV;
> >
> > lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
> > of_node_put(endpoint);
> > + if (lt->data_lanes < 0) {
>
> Ah flip. Unfortunately, ->data_lanes is a u8 so it can't be negative.
>
oups ^^.
> > + dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
> > + return lt->data_lanes;
> > + }
>
> regards,
> dan carpenter
>
Thanks,
Adrien
More information about the dri-devel
mailing list