lkml.org 
[lkml]   [2017]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] drm/i915/opregion: Remove null check before kfree
Date
On Wed, 30 Aug 2017, Himanshu Jha <himanshujha199640@gmail.com> wrote:
> kfree on NULL pointer is a no-op and therefore checking is redundant.

IMO the code has more clarity as it is.

BR,
Jani.

>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
> drivers/gpu/drm/i915/intel_opregion.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 98154ef..2427b40 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -830,10 +830,8 @@ void intel_opregion_unregister(struct drm_i915_private *dev_priv)
> memunmap(opregion->rvda);
> opregion->rvda = NULL;
> }
> - if (opregion->vbt_firmware) {
> - kfree(opregion->vbt_firmware);
> - opregion->vbt_firmware = NULL;
> - }
> + kfree(opregion->vbt_firmware);
> + opregion->vbt_firmware = NULL;
> opregion->header = NULL;
> opregion->acpi = NULL;
> opregion->swsci = NULL;

--
Jani Nikula, Intel Open Source Technology Center

\
 
 \ /
  Last update: 2017-08-31 08:30    [W:0.035 / U:0.344 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site