[PATCH] drm/radeon: Remove unnecessary NULL test before kfree in 'radeon_connector_free_edid'

Alex Deucher alexdeucher at gmail.com
Wed Jul 26 18:29:00 UTC 2023


Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

On Wed, Jul 26, 2023 at 12:24 PM Srinivasan Shanmugam
<srinivasan.shanmugam at amd.com> wrote:
>
> Fixes the below:
>
> WARNING: kfree(NULL) is safe and this check is probably not required.
>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
>  drivers/gpu/drm/radeon/radeon_connectors.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
> index 4ceceb972e8d..d2f02c3dfce2 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -333,10 +333,8 @@ static void radeon_connector_free_edid(struct drm_connector *connector)
>  {
>         struct radeon_connector *radeon_connector = to_radeon_connector(connector);
>
> -       if (radeon_connector->edid) {
> -               kfree(radeon_connector->edid);
> -               radeon_connector->edid = NULL;
> -       }
> +       kfree(radeon_connector->edid);
> +       radeon_connector->edid = NULL;
>  }
>
>  static int radeon_ddc_get_modes(struct drm_connector *connector)
> --
> 2.25.1
>


More information about the amd-gfx mailing list