Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Sergei Shtylyov <sshtylyov@mvista.com>
Cc: Tejun Heo <tj@kernel.org>, Jeff Garzik <jgarzik@redhat.com>,
	Fang Wenqi <anton.fang@gmail.com>,
	linux-ide@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	antonf@turbolinux.com.cn
Subject: Re: [PATCH] drivers/ata/libata-eh.c: fix unused variable warning
Date: Fri, 23 Apr 2010 10:18:14 -0400	[thread overview]
Message-ID: <4BD1AC26.1010204@garzik.org> (raw)
In-Reply-To: <4BD1A99C.8010803@ru.mvista.com>

On 04/23/2010 10:07 AM, Sergei Shtylyov wrote:
> Hello.
>
> Jeff Garzik wrote:
>
>>>>>> Sorry that the title should be:
>>>>>> "fix uninitialized variable warning"
>>>>>>
>>>>>> not
>>>>>> "fix unused variable warning"
>>>>>>
>>>>>> Need I re-send the patch mail ?
>>>>>
>>>>> Yes, please do so. gcc 4.4.1 generates a spurious warning on it too.
>>>>>
>>>>> Acked-by: Tejun Heo<tj@kernel.org>
>>>>
>>>> It's not a spurious warning. The code failed to fully initialize all
>>>> fields of the ata_taskfile structure, prior to copying the ata_taskfile
>>>> structure into qc->result_tf.
>>>
>>> Hmmmm.... right, I've always thought it was gcc not noticing the
>>> structure is being initialized in ata_eh_read_log_10h() but it
>>> actually is noticing much more, so something like the following is
>>> more appropriate?
>>>
>>> Subject: libata: fully initialize @tf in ata_eh_read_log_10h()
>>>
>>> ata_eh_read_log_10h() filled @tf only partially. It didn't cause any
>>> correctness issues but triggered spruious uninitialized variable
>>> warning. Do ata_tf_init() before filling in @tf.
>>>
>>> Signed-off-by: Tejun Heo<tj@kernel.org>
>>
>> Sorry, I should have also pointed out that a fix went upstream to
>> Linus in the last batch of fixes...
>
> I thought Tejun was fixing a different function, no?

Tejun put the fix in the callee; I put the fix in the caller, who 
instantiated the automatic variable.  Either way, the same region of 
memory gets initialized.

	Jeff




  reply	other threads:[~2010-04-23 14:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 14:07 [PATCH] drivers/ata/libata-eh.c: fix unused variable warning Fang Wenqi
2010-04-21 14:24 ` Alan Cox
2010-04-21 14:57   ` Fang Wenqi
2010-04-22  1:23     ` Fang Wenqi
2010-04-23  6:30       ` Tejun Heo
2010-04-23  6:43         ` Jeff Garzik
2010-04-23  7:01           ` Tejun Heo
2010-04-23 13:52             ` Jeff Garzik
2010-04-23 14:02               ` Tejun Heo
2010-04-23 14:07               ` Sergei Shtylyov
2010-04-23 14:18                 ` Jeff Garzik [this message]
2010-04-23  6:48         ` Fang Wenqi
2010-04-23  1:54 ` Jeff Garzik

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=4BD1AC26.1010204@garzik.org \
    --to=jeff@garzik.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=anton.fang@gmail.com \
    --cc=antonf@turbolinux.com.cn \
    --cc=jgarzik@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=sshtylyov@mvista.com \
    --cc=tj@kernel.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