linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	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
Date: Thu, 24 Nov 2016 02:20:38 -0800	[thread overview]
Message-ID: <1479982838.19726.3.camel@perches.com> (raw)
In-Reply-To: <1479963668-22845-2-git-send-email-cw00.choi@samsung.com>

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);
>  }

  reply	other threads:[~2016-11-24 10:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161124050125epcas1p466fc832e77cfe122454b8d40d0f6744e@epcas1p4.samsung.com>
2016-11-24  5:01 ` [PATCH 0/6] PM / devfreq: Modify devfreq/devfreq-event for improvement Chanwoo Choi
2016-11-24  5:01   ` [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Chanwoo Choi
2016-11-24 10:20     ` Joe Perches [this message]
2016-11-24 10:46       ` Chanwoo Choi
2016-11-24 10:52         ` Joe Perches
2016-11-24 23:37           ` Chanwoo Choi
2016-11-24  5:01   ` [PATCH 2/6] PM / devfreq: Modify the device name as devfreq[X] for sysfs Chanwoo Choi
2016-11-24  5:01   ` [PATCH 3/6] PM / devfreq: event: Simplify the sysfs name of devfreq-event device Chanwoo Choi
2016-11-24  5:01   ` [PATCH 4/6] PM / devfreq: Remove the duplicate sysfs entry for current frequency Chanwoo Choi
2016-11-24  5:01   ` [PATCH 5/6] PM / devfreq: event: exynos-ppmu: Use the regmap interface to handle the registers Chanwoo Choi
2016-11-24  5:01   ` [PATCH 6/6] PM / devfreq: event: exynos-ppmu: Add the completion log of device registration Chanwoo Choi
2016-12-15  9:56   ` [PATCH 0/6] PM / devfreq: Modify devfreq/devfreq-event for improvement Chanwoo Choi

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=1479982838.19726.3.camel@perches.com \
    --to=joe@perches.com \
    --cc=chanwoo@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).