From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757043AbcKXKUn (ORCPT ); Thu, 24 Nov 2016 05:20:43 -0500 Received: from smtprelay0110.hostedemail.com ([216.40.44.110]:45910 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753039AbcKXKUm (ORCPT ); Thu, 24 Nov 2016 05:20:42 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3870:3871:3872:4250:4321:5007:7774:7901:10004:10400:10848:11026:11232:11658:11914:12043:12296:12740:12760:13439:14181:14659:14721:21080:21324:21451:30054:30056:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: park79_7a44a6a70fe58 X-Filterd-Recvd-Size: 3057 Message-ID: <1479982838.19726.3.camel@perches.com> Subject: Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings From: Joe Perches To: Chanwoo Choi , myungjoo.ham@samsung.com, kyungmin.park@samsung.com Cc: rjw@rjwysocki.net, chanwoo@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 24 Nov 2016 02:20:38 -0800 In-Reply-To: <1479963668-22845-2-git-send-email-cw00.choi@samsung.com> References: <1479963668-22845-1-git-send-email-cw00.choi@samsung.com> <1479963668-22845-2-git-send-email-cw00.choi@samsung.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.1-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2016-11-24 at 14:01 +0900, Chanwoo Choi wrote: > This patch just fixes the checkpatch warnings. unrelated trivia: > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c [] > @@ -538,15 +538,14 @@ struct devfreq *devfreq_add_device(struct device *dev, > devfreq = find_device_devfreq(dev); > mutex_unlock(&devfreq_list_lock); > if (!IS_ERR(devfreq)) { > - dev_err(dev, "%s: Unable to create devfreq for the device. It already has one.\n", __func__); > + dev_err(dev, "%s: Unable to create devfreq for the device.\n", > + __func__); > err = -EINVAL; > goto err_out; > } It seems to be simpler if find_device_devfreq just returned NULL in the error cases as the only test is IS_ERR and not a specific error return type. Then these IS_ERR calls could be a NULL pointer test instead. > @@ -576,11 +575,13 @@ struct devfreq *devfreq_add_device(struct device *dev, > goto err_out; > } > > - devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) * > + devfreq->trans_table = devm_kzalloc(&devfreq->dev, > + sizeof(unsigned int) * > devfreq->profile->max_state * > devfreq->profile->max_state, > GFP_KERNEL); > - devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) * > + devfreq->time_in_state = devm_kzalloc(&devfreq->dev, > + sizeof(unsigned long) * > devfreq->profile->max_state, > GFP_KERNEL); Maybe these should be devm_kcalloc calls > devfreq->last_stat_updated = jiffies; > @@ -990,7 +991,7 @@ static ssize_t cur_freq_show(struct device *dev, struct device_attribute *attr, > > if (devfreq->profile->get_cur_freq && > !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq)) > - return sprintf(buf, "%lu\n", freq); > + return sprintf(buf, "%lu\n", freq); Be nicer to align the second line in the if test here too if (devfreq->profile->get_cur_freq && !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq)) return sprintf(buf, "%lu\n", freq); > return sprintf(buf, "%lu\n", devfreq->previous_freq); > }