[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM2PR03MB574733935AECD0167EEF580FA510@DM2PR03MB574.namprd03.prod.outlook.com>
Date: Thu, 10 Sep 2015 06:17:08 +0000
From: Yuantian Tang <Yuantian.Tang@...escale.com>
To: Tejun Heo <tj@...nel.org>
CC: "hdegoede@...hat.com" <hdegoede@...hat.com>,
"linux-ide@...r.kernel.org" <linux-ide@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: RE: [PATCH] ahci: qoriq: fixed using uninitialized variable warnings
> -----Original Message-----
> From: Tejun Heo [mailto:htejun@...il.com] On Behalf Of Tejun Heo
> Sent: Wednesday, September 09, 2015 10:02 PM
> To: Tang Yuantian-B29983 <Yuantian.Tang@...escale.com>
> Cc: hdegoede@...hat.com; linux-ide@...r.kernel.org; linux-
> kernel@...r.kernel.org; devicetree@...r.kernel.org
> Subject: Re: [PATCH] ahci: qoriq: fixed using uninitialized variable warnings
>
> On Wed, Sep 09, 2015 at 05:16:22PM +0800, Yuantian.Tang@...escale.com
> wrote:
> > From: Tang Yuantian <Yuantian.Tang@...escale.com>
> >
> > kbuild test robot reports the warnings:
> > drivers/ata/ahci_qoriq.c: In function 'ahci_qoriq_hardreset':
> > >> include/asm-generic/io.h:163:2: warning: 'px_is' may be used
> > >> uninitialized in this function [-Wuninitialized]
> > drivers/ata/ahci_qoriq.c:70:14: note: 'px_is' was declared here
> > >> include/asm-generic/io.h:163:2: warning: 'px_cmd' may be used
> > >> uninitialized in this function [-Wuninitialized]
> > drivers/ata/ahci_qoriq.c:70:6: note: 'px_cmd' was declared here
> >
> > This patch fixed it by assigning 0 to px_is and px_cmd variables.
> > This patch also remove line 'struct ccsr_ahci *reg_base' which is not
> > referred by any other codes and thus a dead one.
>
> Hmm... I think the problem here is that the complier can't know whether
> qoriq_priv->type would change across intervening function calls. Maybe a
> better solution is caching the type in a local variable so that the compiler can
> tell that those two tests will always move together? It generally isn't a good
> idea to clear variables unnecessarily as that can hide actual bugs that compiler
> can detect.
>
I am not sure if the warning can be removed this way.
But I will send the patch as your suggestion.
Unfortunately, I can't produce this warning no matter if I add -Wuninitialized.
So please let me know if the new patch is working.
Regards,
Yuantian
> Thanks.
>
> --
> tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists