mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Emilio López" <emilio@elopez.com.ar>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@sisk.pl, shawn.guo@linaro.org, mark.langsdorf@calxeda.com,
	linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpufreq: highbank: do not initialize array with a loop
Date: Mon, 25 Feb 2013 07:58:33 -0300	[thread overview]
Message-ID: <BLU0-SMTP837DD4DF438223EBC6536A8AF30@phx.gbl> (raw)
In-Reply-To: <CAOh2x=nDZpBaqjzO22k66Bb30mVEhAdy02EFDP9RDibA50Sx7A@mail.gmail.com>

Hello,

El 25/02/13 00:41, Viresh Kumar escribió:
> On Sun, Feb 24, 2013 at 10:31 PM, Emilio López <emilio@elopez.com.ar> wrote:
>> As uninitialized array members will be initialized to zero, we can
>> avoid using a for loop by setting a value to it.
>>
>> Signed-off-by: Emilio López <emilio@elopez.com.ar>
>> ---
>> Note that I don't own any device using this driver, it has only been compile
>> tested, but it shouldn't cause any issues.
>>
>>  drivers/cpufreq/highbank-cpufreq.c | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c
>> index 66e3a71..30d4ae1 100644
>> --- a/drivers/cpufreq/highbank-cpufreq.c
>> +++ b/drivers/cpufreq/highbank-cpufreq.c
>> @@ -28,13 +28,9 @@
>>
>>  static int hb_voltage_change(unsigned int freq)
>>  {
>> -       int i;
>> -       u32 msg[HB_CPUFREQ_IPC_LEN];
>> +       u32 msg[HB_CPUFREQ_IPC_LEN] = {HB_CPUFREQ_CHANGE_NOTE};
>>
>> -       msg[0] = HB_CPUFREQ_CHANGE_NOTE;
>>         msg[1] = freq / 1000000;
> 
> I think this can also be part of the definition of array, isn't it?
> 
> So it would be something like:
> 
> u32 msg[HB_CPUFREQ_IPC_LEN] = {HB_CPUFREQ_CHANGE_NOTE, freq / 1000000};
> 

I incorrectly assumed that sparse would complain, but after testing I
see it doesn't. Thanks for pointing it out, I'll send a v2 in a minute.

Emilio

  reply	other threads:[~2013-02-25 11:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-24 17:01 Emilio López
2013-02-25  3:41 ` Viresh Kumar
2013-02-25 10:58   ` Emilio López [this message]
2013-02-25 11:07 ` [PATCH v2] " Emilio López
2013-02-25 11:12   ` Viresh Kumar
2013-02-25 13:53   ` Mark Langsdorf

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=BLU0-SMTP837DD4DF438223EBC6536A8AF30@phx.gbl \
    --to=emilio@elopez.com.ar \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.langsdorf@calxeda.com \
    --cc=rjw@sisk.pl \
    --cc=shawn.guo@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /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

all inboxes | Powered by JetHome®