drm/exynos: vidi: fix a wrong error return
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): CGME20230519000408epcas1p4f5d90f588e7250d2d168d2943adef4f7@epcas1p4.samsung.com
Inki Dae
maintainerPATCH 1/1 drm/exynos: vidi: fix a wrong error return
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.
--- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0 -2
@@ -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);
Signature · 1 line
2.25.1
Hi Inki,
Quoted 16 lines · Inki Dae
Fix a wrong error return by dropping an error return.
When vidi driver is remvoed, if
ctx->raw_edidisn't same asfake_edid_infothen only what we have to is to freectx->raw_edidso that driver removing can work correctly - it's not an error case.Signed-off-by Inki Dae <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_vidi.c static int vidi_remove(struct platform_device *pdev) · line 473
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-2@@ -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
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-0}component_del (&pdev->dev, &vidi_component_ops);Signature · 1 line
2.25.1
Andi Shyti
Reviewed-byHi Inki,
Quoted 36 lines · Andi Shyti
Hi Inki,
Quoted 16 lines · Inki Dae
Fix a wrong error return by dropping an error return.
When vidi driver is remvoed, if
ctx->raw_edidisn't same asfake_edid_infothen only what we have to is to freectx->raw_edidso that driver removing can work correctly - it's not an error case.Signed-off-by Inki Dae <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-0drivers/gpu/drm/exynos/exynos_drm_vidi.c static int vidi_remove(struct platform_device *pdev) · line 473
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-2@@ -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:
(quoted diff) +1
-7- if (ctx->raw_edid != (struct edid *)fake_edid_info) { - kfree(ctx->raw_edid); - ctx->raw_edid = NULL; - - return -EINVAL; - } - + ctx->raw_edid = NULL;
Quoted 7 lines
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_infobecause 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.
Andi
PS I was actually sleeping and this woke me up :)
Quoted 7 lines
Andi
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-0}component_del (&pdev->dev, &vidi_component_ops);Signature · 1 line
2.25.1
대인기
maintainerHi Andi, :)
Quoted 45 lines
-----Original Message-----
From: Andi Shyti <[email protected]>
Sent: Friday, May 19, 2023 9:27 AM
To: Inki Dae <[email protected]>
Cc: [email protected]; [email protected]; Andi Shyti <[email protected]>
Subject: Re: [PATCH] drm/exynos: vidi: fix a wrong error returnHi Inki,
Quoted 6 lines · Inki Dae
Fix a wrong error return by dropping an error return.
When vidi driver is remvoed, if
ctx->raw_edidisn't same asfake_edid_infothen only what we have to is to freectx->raw_edidso that driver removing can work correctly - it's not an error case.Review
Quoted 6 lines
Signed-off-by Inki Dae <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- 1 file changed, 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_drm_vidi.cdrivers/gpu/drm/exynos/exynos_drm_vidi.c static int vidi_remove(struct platform_device *pdev) · line 473
Quoted 9 lines
index
4d56c8c799c5..f5e1adfcaa51100644drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-2@@ -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:
(quoted diff) +1
-7- if (ctx->raw_edid != (struct edid *)fake_edid_info) { - kfree(ctx->raw_edid); - ctx->raw_edid = NULL; - - return -EINVAL; - } - + ctx->raw_edid = NULL;
Quoted 7 lines
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_infobecause 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-
Quoted 1 line
raw_edidbykmemdup(). :)
Thanks,
Inki Dae
Quoted 8 lines
Andi
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-1}component_del (&pdev->dev, &vidi_component_ops); --2.25.1
Hi Inki,
Quoted 28 lines
Quoted 18 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c static int vidi_remove(struct platform_device *pdev) · line 473
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-2@@ -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:
(quoted diff) +1
-7- if (ctx->raw_edid != (struct edid *)fake_edid_info) { - kfree(ctx->raw_edid); - ctx->raw_edid = NULL; - - return -EINVAL; - } - + ctx->raw_edid = NULL;Quoted 7 lines
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_infobecause 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.
Quoted 6 lines
"
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_edidobject needs to be released becausectx->raw_edidobject is allocated and the edid object sent by user is copied to the ctx-Quoted 1 line
raw_edidbykmemdup(). :)
yes... yes... I sent you another e-mail after this :)
Thanks,
Andi
2023년 5월 19일 (금) 오후 6:21, Andi Shyti <[email protected]>님이 작성:
Quoted 35 lines
Hi Inki,
Quoted 1 line
Quoted 1 line
Review static int vidi_remove(struct platform_device
Quoted 1 line
(quoted diff) +0
-0@@ -469,8 +469,6 @@ static int vidi_remove(struct platform_device*pdev)
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c static int vidi_remove(struct platform_device *pdev) · line 473
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0
-2if (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:
(quoted diff) +1
-7- 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.Quoted 8 lines
Quoted 4 lines
A follow-up cleanup should be to remove the "const" from
fake_edid_infobecause 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 userthrough
Quoted 1 line
the ictl system call -
vidi_connection_ioctl- is used instead of fakeone -
Quoted 9 lines
Quoted 2 lines
face_edid_info.
In this case,ctx->raw_edidobject needs to be released because
ctx->raw_edidQuoted 1 line
object is allocated and the edid object sent by user is copied to the
ctx-
Quoted 1 line
Quoted 1 line
raw_edidbykmemdup(). :)yes... yes... I sent you another e-mail after this :)
I didn't check the second email you sent. :)
Thanks,
Inki Dae
Quoted 3 lines
Thanks,
Andi