public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: MyungJoo Ham <myungjoo.ham@samsung.com>
To: zhong jiang <zhongjiang@huawei.com>,
	Kyungmin Park <kyungmin.park@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] PM / devfreq: remove redundant null pointer check before kfree
Date: Thu, 27 Sep 2018 11:25:36 +0900	[thread overview]
Message-ID: <529236451.01538015400755.JavaMail.epsvc@epcpmgr01> (raw)
In-Reply-To: <1537535923-46240-1-git-send-email-zhongjiang@huawei.com>

 
> kfree has taken the null pointer into account. hence it is safe
> to remove the redundant null pointer check before kfree.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

> ---
>  drivers/devfreq/devfreq.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 4c49bb1..c37021d 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -675,8 +675,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
>  	device_unregister(&devfreq->dev);
>  	devfreq = NULL;
>  err_dev:
> -	if (devfreq)
> -		kfree(devfreq);
> +	kfree(devfreq);
>  err_out:
>  	return ERR_PTR(err);
>  }
> -- 
> 1.7.12.4

 
--
MyungJoo Ham (함명주), Ph.D.
Autonomous Machine Lab., AI Center, Samsung Research.
Cell: +82-10-6714-2858

      reply	other threads:[~2018-09-27  2:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180921133110epcas4p3d2914c21c881e2dfb6a2e2d9708f7a43@epcms1p7>
2018-09-21 13:18 ` [PATCH] PM / devfreq: remove redundant null pointer check before kfree zhong jiang
2018-09-27  2:25   ` MyungJoo Ham [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=529236451.01538015400755.JavaMail.epsvc@epcpmgr01 \
    --to=myungjoo.ham@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=zhongjiang@huawei.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