public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Himanshu Jha <himanshujha199640@gmail.com>
Cc: joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com,
	airlied@linux.ie, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Himanshu Jha <himanshujha199640@gmail.com>
Subject: Re: [PATCH] drm/i915/opregion: Remove null check before kfree
Date: Thu, 31 Aug 2017 09:30:05 +0300	[thread overview]
Message-ID: <87o9qw8d1u.fsf@intel.com> (raw)
In-Reply-To: <1504099876-4142-1-git-send-email-himanshujha199640@gmail.com>

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

      reply	other threads:[~2017-08-31  6:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 13:31 [PATCH] drm/i915/opregion: Remove null check before kfree Himanshu Jha
2017-08-31  6:30 ` Jani Nikula [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9qw8d1u.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=himanshujha199640@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox