* [PATCH] PM / devfreq: remove redundant null pointer check before kfree @ 2018-09-21 13:18 ` zhong jiang 2018-09-27 2:25 ` MyungJoo Ham 0 siblings, 1 reply; 2+ messages in thread From: zhong jiang @ 2018-09-21 13:18 UTC (permalink / raw) To: myungjoo.ham, kyungmin.park; +Cc: cw00.choi, linux-pm, linux-kernel 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> --- 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 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] PM / devfreq: remove redundant null pointer check before kfree 2018-09-21 13:18 ` [PATCH] PM / devfreq: remove redundant null pointer check before kfree zhong jiang @ 2018-09-27 2:25 ` MyungJoo Ham 0 siblings, 0 replies; 2+ messages in thread From: MyungJoo Ham @ 2018-09-27 2:25 UTC (permalink / raw) To: zhong jiang, Kyungmin Park Cc: Chanwoo Choi, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org > 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 ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-27 2:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox