[PATCH] drm/exynos: vidi: fix a wrong error return

Inki Dae daeinki at gmail.com
Tue May 23 02:36:25 UTC 2023


2023년 5월 19일 (금) 오후 6:21, Andi Shyti <andi.shyti at linux.intel.com>님이 작성:

> Hi Inki,
>
> > > > @@ -469,8 +469,6 @@ static int vidi_remove(struct platform_device
> *pdev)
> > > >   if (ctx->raw_edid != (struct edid *)fake_edid_info) {
> > > >           kfree(ctx->raw_edid);
> > > >           ctx->raw_edid = NULL;
> > > > -
> > > > -         return -EINVAL;
> > >
> > > It doesn't look right to me, I think the correct patch should be:
> > >
> > > -       if (ctx->raw_edid != (struct edid *)fake_edid_info) {
> > > -               kfree(ctx->raw_edid);
> > > -               ctx->raw_edid = NULL;
> > > -
> > > -               return -EINVAL;
> > > -       }
> > > -
> > > +       ctx->raw_edid = NULL;
> > >
> > > because "ctx->raw_edid" points to a non allocated memory in the
> > > .data segment and you cannot free it.
> > >
> > > A follow-up cleanup should be to remove the "const" from
> > > fake_edid_info because you are assigning its address to pointers
> > > (raw_edid), so that what's the point for having it const? You are
> > > just fooling the compiler :)
> >
> > Thanks for review comment.
> >
> > "ctx->raw_edid != fake_edid_info" means that the edid sent by the user
> through
> > the ictl system call - vidi_connection_ioctl - is used instead of fake
> one -
> > face_edid_info.
> > In this case, ctx->raw_edid object needs to be released because
> ctx->raw_edid
> > object is allocated and the edid object sent by user is copied to the
> ctx-
> > >raw_edid by kmemdup(). :)
>
> yes... yes... I sent you another e-mail after this :)
>

I didn't check the second email you sent. :)

Thanks,
Inki Dae


> Thanks,
> Andi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230523/bb4f41be/attachment.htm>


More information about the dri-devel mailing list