* [PATCH] drm/exynos: vidi: fix a wrong error return [not found] <CGME20230519000408epcas1p4f5d90f588e7250d2d168d2943adef4f7@epcas1p4.samsung.com> @ 2023-05-19 0:04 ` Inki Dae 2023-05-19 0:26 ` Andi Shyti 0 siblings, 1 reply; 5+ messages in thread From: Inki Dae @ 2023-05-19 0:04 UTC (permalink / raw) To: dri-devel, linux-samsung-soc; +Cc: Inki Dae Fix a wrong error return by dropping an error return. When vidi driver is remvoed, if ctx->raw_edid isn't same as fake_edid_info then only what we have to is to free ctx->raw_edid so that driver removing can work correctly - it's not an error case. Signed-off-by: Inki Dae <inki.dae@samsung.com> --- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 4d56c8c799c5..f5e1adfcaa51 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -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; } component_del(&pdev->dev, &vidi_component_ops); -- 2.25.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/exynos: vidi: fix a wrong error return 2023-05-19 0:04 ` [PATCH] drm/exynos: vidi: fix a wrong error return Inki Dae @ 2023-05-19 0:26 ` Andi Shyti 2023-05-19 2:37 ` Andi Shyti 2023-05-19 4:22 ` 대인기 0 siblings, 2 replies; 5+ messages in thread From: Andi Shyti @ 2023-05-19 0:26 UTC (permalink / raw) To: Inki Dae; +Cc: dri-devel, linux-samsung-soc, Andi Shyti Hi Inki, On Fri, May 19, 2023 at 09:04:07AM +0900, Inki Dae wrote: > Fix a wrong error return by dropping an error return. > > When vidi driver is remvoed, if ctx->raw_edid isn't same as fake_edid_info > then only what we have to is to free ctx->raw_edid so that driver removing > can work correctly - it's not an error case. > > Signed-off-by: Inki Dae <inki.dae@samsung.com> > --- > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c > index 4d56c8c799c5..f5e1adfcaa51 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c > @@ -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 :) Andi > } > > component_del(&pdev->dev, &vidi_component_ops); > -- > 2.25.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/exynos: vidi: fix a wrong error return 2023-05-19 0:26 ` Andi Shyti @ 2023-05-19 2:37 ` Andi Shyti 2023-05-19 4:22 ` 대인기 1 sibling, 0 replies; 5+ messages in thread From: Andi Shyti @ 2023-05-19 2:37 UTC (permalink / raw) To: Andi Shyti; +Cc: Inki Dae, dri-devel, linux-samsung-soc, Andi Shyti Hi Inki, On Fri, May 19, 2023 at 02:26:40AM +0200, Andi Shyti wrote: > Hi Inki, > > On Fri, May 19, 2023 at 09:04:07AM +0900, Inki Dae wrote: > > Fix a wrong error return by dropping an error return. > > > > When vidi driver is remvoed, if ctx->raw_edid isn't same as fake_edid_info > > then only what we have to is to free ctx->raw_edid so that driver removing > > can work correctly - it's not an error case. > > > > Signed-off-by: Inki Dae <inki.dae@samsung.com> > > --- > > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c > > index 4d56c8c799c5..f5e1adfcaa51 100644 > > --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c > > +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c > > @@ -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 :) please ignore, this is what happens when reading patches at 2.26am, that a "!=" becomes "==". The patch is correct, still some cleanups is needed here, though. Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Andi PS I was actually sleeping and this woke me up :) > Andi > > > } > > > > component_del(&pdev->dev, &vidi_component_ops); > > -- > > 2.25.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] drm/exynos: vidi: fix a wrong error return 2023-05-19 0:26 ` Andi Shyti 2023-05-19 2:37 ` Andi Shyti @ 2023-05-19 4:22 ` 대인기 2023-05-19 9:21 ` Andi Shyti 1 sibling, 1 reply; 5+ messages in thread From: 대인기 @ 2023-05-19 4:22 UTC (permalink / raw) To: 'Andi Shyti'; +Cc: dri-devel, linux-samsung-soc, 'Andi Shyti' Hi Andi, :) > -----Original Message----- > From: Andi Shyti <andi.shyti@linux.intel.com> > Sent: Friday, May 19, 2023 9:27 AM > To: Inki Dae <inki.dae@samsung.com> > Cc: dri-devel@lists.freedesktop.org; linux-samsung-soc@vger.kernel.org; Andi > Shyti <andi.shyti@kernel.org> > Subject: Re: [PATCH] drm/exynos: vidi: fix a wrong error return > > Hi Inki, > > On Fri, May 19, 2023 at 09:04:07AM +0900, Inki Dae wrote: > > Fix a wrong error return by dropping an error return. > > > > When vidi driver is remvoed, if ctx->raw_edid isn't same as fake_edid_info > > then only what we have to is to free ctx->raw_edid so that driver removing > > can work correctly - it's not an error case. > > > > Signed-off-by: Inki Dae <inki.dae@samsung.com> > > --- > > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c > b/drivers/gpu/drm/exynos/exynos_drm_vidi.c > > index 4d56c8c799c5..f5e1adfcaa51 100644 > > --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c > > +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c > > @@ -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(). :) Thanks, Inki Dae > > Andi > > > } > > > > component_del(&pdev->dev, &vidi_component_ops); > > -- > > 2.25.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/exynos: vidi: fix a wrong error return 2023-05-19 4:22 ` 대인기 @ 2023-05-19 9:21 ` Andi Shyti 0 siblings, 0 replies; 5+ messages in thread From: Andi Shyti @ 2023-05-19 9:21 UTC (permalink / raw) To: ���α� Cc: 'Andi Shyti', dri-devel, linux-samsung-soc, 'Andi Shyti' 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 :) Thanks, Andi ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-19 9:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20230519000408epcas1p4f5d90f588e7250d2d168d2943adef4f7@epcas1p4.samsung.com>
2023-05-19 0:04 ` [PATCH] drm/exynos: vidi: fix a wrong error return Inki Dae
2023-05-19 0:26 ` Andi Shyti
2023-05-19 2:37 ` Andi Shyti
2023-05-19 4:22 ` 대인기
2023-05-19 9:21 ` Andi Shyti
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox