diff mbox

drm/radeon: remove some dead code

Message ID 20170207131604.GA27416@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Feb. 7, 2017, 1:16 p.m. UTC
If "rdev->bios" is NULL then we don't need to free it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Michel Dänzer Feb. 8, 2017, 12:43 a.m. UTC | #1
On 07/02/17 10:16 PM, Dan Carpenter wrote:
> If "rdev->bios" is NULL then we don't need to free it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
> index 00cfb5d2875f..04c0ed41374f 100644
> --- a/drivers/gpu/drm/radeon/radeon_bios.c
> +++ b/drivers/gpu/drm/radeon/radeon_bios.c
> @@ -638,10 +638,8 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
>  					     vhdr->ImageLength,
>  					     GFP_KERNEL);
>  
> -			if (!rdev->bios) {
> -				kfree(rdev->bios);
> +			if (!rdev->bios)
>  				return false;
> -			}
>  			return true;

Could be simplified further to

			return rdev->bios != NULL;

or maybe

			return !!rdev->bios;

Either way,

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Alex Deucher Feb. 9, 2017, 2:11 a.m. UTC | #2
On Tue, Feb 7, 2017 at 8:16 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> If "rdev->bios" is NULL then we don't need to free it.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

applied.  thanks!

>
> diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
> index 00cfb5d2875f..04c0ed41374f 100644
> --- a/drivers/gpu/drm/radeon/radeon_bios.c
> +++ b/drivers/gpu/drm/radeon/radeon_bios.c
> @@ -638,10 +638,8 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
>                                              vhdr->ImageLength,
>                                              GFP_KERNEL);
>
> -                       if (!rdev->bios) {
> -                               kfree(rdev->bios);
> +                       if (!rdev->bios)
>                                 return false;
> -                       }
>                         return true;
>                 }
>         }
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 00cfb5d2875f..04c0ed41374f 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -638,10 +638,8 @@  static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
 					     vhdr->ImageLength,
 					     GFP_KERNEL);
 
-			if (!rdev->bios) {
-				kfree(rdev->bios);
+			if (!rdev->bios)
 				return false;
-			}
 			return true;
 		}
 	}