[PATCH] drm/exynos: vidi: fix a wrong error return
Andi Shyti
andi.shyti at linux.intel.com
Fri May 19 00:26:35 UTC 2023
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 at 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
More information about the dri-devel
mailing list