[PATCH] drm/radeon: Remove redundant NULL check before kfree

Jerome Glisse j.glisse at gmail.com
Mon Feb 25 07:21:30 PST 2013


On Sun, Feb 24, 2013 at 6:18 PM, Syam Sidhardhan <syamsidhardh at gmail.com> wrote:
> kfree on NULL pointer is a no-op.
>
> Signed-off-by: Syam Sidhardhan <s.syam at samsung.com>
Reviewed-by: Jerome Glisse <jglisse at redhat.com>

> ---
>  drivers/gpu/drm/radeon/radeon_connectors.c |    6 ++----
>  drivers/gpu/drm/radeon/radeon_pm.c         |    3 +--
>  2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
> index 2399f25..57828e6 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -643,8 +643,7 @@ static void radeon_connector_destroy(struct drm_connector *connector)
>  {
>         struct radeon_connector *radeon_connector = to_radeon_connector(connector);
>
> -       if (radeon_connector->edid)
> -               kfree(radeon_connector->edid);
> +       kfree(radeon_connector->edid);
>         kfree(radeon_connector->con_priv);
>         drm_sysfs_connector_remove(connector);
>         drm_connector_cleanup(connector);
> @@ -1209,8 +1208,7 @@ static void radeon_dp_connector_destroy(struct drm_connector *connector)
>         struct radeon_connector *radeon_connector = to_radeon_connector(connector);
>         struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv;
>
> -       if (radeon_connector->edid)
> -               kfree(radeon_connector->edid);
> +       kfree(radeon_connector->edid);
>         if (radeon_dig_connector->dp_i2c_bus)
>                 radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus);
>         kfree(radeon_connector->con_priv);
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
> index 338fd6a..2a51611 100644
> --- a/drivers/gpu/drm/radeon/radeon_pm.c
> +++ b/drivers/gpu/drm/radeon/radeon_pm.c
> @@ -662,8 +662,7 @@ void radeon_pm_fini(struct radeon_device *rdev)
>                 device_remove_file(rdev->dev, &dev_attr_power_method);
>         }
>
> -       if (rdev->pm.power_state)
> -               kfree(rdev->pm.power_state);
> +       kfree(rdev->pm.power_state);
>
>         radeon_hwmon_fini(rdev);
>  }
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list