From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938652AbcKXKqV (ORCPT ); Thu, 24 Nov 2016 05:46:21 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:45629 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936026AbcKXKqT (ORCPT ); Thu, 24 Nov 2016 05:46:19 -0500 MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 X-AuditID: cbfee61a-f79916d0000062de-32-5836c4f93505 Content-transfer-encoding: 8BIT Message-id: <5836C4F9.2010509@samsung.com> Date: Thu, 24 Nov 2016 19:46:17 +0900 From: Chanwoo Choi Organization: Samsung Electronics User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Joe Perches , 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 Subject: Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings References: <1479963668-22845-1-git-send-email-cw00.choi@samsung.com> <1479963668-22845-2-git-send-email-cw00.choi@samsung.com> <1479982838.19726.3.camel@perches.com> In-reply-to: <1479982838.19726.3.camel@perches.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsVy+t9jAd2fR8wiDPZ1yFtMvHGFxWL2/ccs Fmeb3rBbXN41h83ic+8RRovbjSvYLM6cvsTqwO6xaVUnm8eXVdeYPbZcbWfx6NuyitHj8ya5 ANYoN5uM1MSU1CKF1Lzk/JTMvHRbpdAQN10LJYW8xNxUW6UIXd+QICWFssScUiDPyAANODgH uAcr6dsluGXcm3iSsWCbUMX3mRkNjFf5uhg5OCQETCQa34Z0MXICmWISF+6tZwOxhQSWMko0 7NQAsXkFBCV+TL7HAlLOLCAvceRSNkiYWUBdYtK8RcxdjFxA5Q8YJe42XGSHqNeSaFjVD2az CKhK3L83CWwmG1B8/4sbYDa/gKLE1R+PGUFmigpESHSfqAQJiwCZ/3esZIWYnywx/8JOFhBb WMBJou9xLyPErn+MEt3vFzGBJDgFjCXaXpxinMAoOAvJqbMQTp2F5NQFjMyrGCVSC5ILipPS cw3zUsv1ihNzi0vz0vWS83M3MYJj7pnUDsaDu9wPMQpwMCrx8D4wM4sQYk0sK67MPcQowcGs JMLrdxAoxJuSWFmVWpQfX1Sak1p8iNEU6NeJzFKiyfnAdJBXEm9oYm5ibmxgYW5paWKkJM7b OPtZuJBAemJJanZqakFqEUwfEwenVAOjXPCWC0Krjk1bLfHd4/i59x+uKN5JuzR/yuHP1ueD e7f9luc698/sYYX7g5iDWZJzt3HOOLHiZDSjzJqTPdufnvvhtKlWXnCS5XS5ACehP43OJVNC dPr8vyzSua33sDJp6Ud2Lb4rkRtcZO1yfLq+vPRR7rMp2BF4Y8bp0gOHUy23P2HPz550SYml OCPRUIu5qDgRAIG7B17PAgAA X-MTR: 20000000000000000@CPGS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016년 11월 24일 19:20, Joe Perches wrote: > 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 Why should devfreq use the devm_kcalloc? > >> 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); >> } > > > -- Best Regards, Chanwoo Choi