* [PATCH] PCI: rockchip: fix uninitialized variable use
@ 2016-09-22 9:39 Arnd Bergmann
2016-09-22 17:15 ` Brian Norris
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-09-22 9:39 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Wenrui Li, Heiko Stuebner, Arnd Bergmann, linux-pci, Shawn Lin,
Brian Norris, linux-kernel, linux-rockchip, linux-arm-kernel
The newly added pcie-rockchip driver fails to initialize the
io_size variable if the DT doesn't provide ranges for the PCI
I/O space, as found by building it with -Wmaybe-uninitialized:
drivers/pci/host/pcie-rockchip.c: In function 'rockchip_pcie_probe':
drivers/pci/host/pcie-rockchip.c:1007:6: warning: 'io_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
This adds an appropriate initialization immediately in front of
the loop, so the io_size is zero as expected afterwards for that
case.
Fixes: abe17181b16f ("PCI: rockchip: Add Rockchip PCIe controller support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/pci/host/pcie-rockchip.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index c3593e633ccd..8bedc1e1ef80 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -1078,6 +1078,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
goto err_vpcie;
/* Get the I/O and memory ranges from DT */
+ io_size = 0;
resource_list_for_each_entry(win, &res) {
switch (resource_type(win->res)) {
case IORESOURCE_IO:
--
2.9.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: rockchip: fix uninitialized variable use
2016-09-22 9:39 [PATCH] PCI: rockchip: fix uninitialized variable use Arnd Bergmann
@ 2016-09-22 17:15 ` Brian Norris
2016-09-23 0:15 ` Shawn Lin
2016-09-28 16:59 ` Bjorn Helgaas
2 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2016-09-22 17:15 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Heiko Stuebner, linux-pci, Shawn Lin, Wenrui Li, linux-kernel,
linux-rockchip, Bjorn Helgaas, linux-arm-kernel
On Thu, Sep 22, 2016 at 11:39:59AM +0200, Arnd Bergmann wrote:
> The newly added pcie-rockchip driver fails to initialize the
> io_size variable if the DT doesn't provide ranges for the PCI
> I/O space, as found by building it with -Wmaybe-uninitialized:
>
> drivers/pci/host/pcie-rockchip.c: In function 'rockchip_pcie_probe':
> drivers/pci/host/pcie-rockchip.c:1007:6: warning: 'io_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> This adds an appropriate initialization immediately in front of
> the loop, so the io_size is zero as expected afterwards for that
> case.
>
> Fixes: abe17181b16f ("PCI: rockchip: Add Rockchip PCIe controller support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/pci/host/pcie-rockchip.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> index c3593e633ccd..8bedc1e1ef80 100644
> --- a/drivers/pci/host/pcie-rockchip.c
> +++ b/drivers/pci/host/pcie-rockchip.c
> @@ -1078,6 +1078,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> goto err_vpcie;
>
> /* Get the I/O and memory ranges from DT */
> + io_size = 0;
> resource_list_for_each_entry(win, &res) {
> switch (resource_type(win->res)) {
> case IORESOURCE_IO:
I feel like we've fixed this one before, but then it's been refactored
many times along the way...
Reviewed-by: Brian Norris <briannorris@chromium.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: rockchip: fix uninitialized variable use
2016-09-22 9:39 [PATCH] PCI: rockchip: fix uninitialized variable use Arnd Bergmann
2016-09-22 17:15 ` Brian Norris
@ 2016-09-23 0:15 ` Shawn Lin
2016-09-28 16:59 ` Bjorn Helgaas
2 siblings, 0 replies; 4+ messages in thread
From: Shawn Lin @ 2016-09-23 0:15 UTC (permalink / raw)
To: Arnd Bergmann, Bjorn Helgaas
Cc: Wenrui Li, Heiko Stuebner, linux-pci, shawn.lin, Brian Norris,
linux-kernel, linux-rockchip, linux-arm-kernel
SGkgQXJuZCwKCtTaIDIwMTYvOS8yMiAxNzozOSwgQXJuZCBCZXJnbWFubiDQtLXAOgo+IFRoZSBu
ZXdseSBhZGRlZCBwY2llLXJvY2tjaGlwIGRyaXZlciBmYWlscyB0byBpbml0aWFsaXplIHRoZQo+
IGlvX3NpemUgdmFyaWFibGUgaWYgdGhlIERUIGRvZXNuJ3QgcHJvdmlkZSByYW5nZXMgZm9yIHRo
ZSBQQ0kKPiBJL08gc3BhY2UsIGFzIGZvdW5kIGJ5IGJ1aWxkaW5nIGl0IHdpdGggLVdtYXliZS11
bmluaXRpYWxpemVkOgo+Cj4gZHJpdmVycy9wY2kvaG9zdC9wY2llLXJvY2tjaGlwLmM6IEluIGZ1
bmN0aW9uICdyb2NrY2hpcF9wY2llX3Byb2JlJzoKPiBkcml2ZXJzL3BjaS9ob3N0L3BjaWUtcm9j
a2NoaXAuYzoxMDA3OjY6IHdhcm5pbmc6ICdpb19zaXplJyBtYXkgYmUgdXNlZCB1bmluaXRpYWxp
emVkIGluIHRoaXMgZnVuY3Rpb24gWy1XbWF5YmUtdW5pbml0aWFsaXplZF0KPgoKU2VlbXMgbGlr
ZSB3ZSBtaXNzIHRoaXMgd2hlbiByZWZhY3RvcmluZyB0aGUgY29kZSBhIGJpdC4KVGhhbmtzIGZv
ciBmaXhpbmcgaXQuCgpBY2tlZC1ieTogU2hhd24gTGluIDxzaGF3bi5saW5Acm9jay1jaGlwcy5j
b20+Cgo+IFRoaXMgYWRkcyBhbiBhcHByb3ByaWF0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mNlX3R5cGUod2luLT5yZXMpKSB7Cj4gIAkJY2FzZSBJT1JFU09VUkNFX0lPOgo+CgoKLS0g
CkJlc3QgUmVnYXJkcwpTaGF3biBMaW4KCgpfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fXwpsaW51eC1hcm0ta2VybmVsIG1haWxpbmcgbGlzdApsaW51eC1hcm0t
a2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmcKaHR0cDovL2xpc3RzLmluZnJhZGVhZC5vcmcvbWFp
bG1hbi9saXN0aW5mby9saW51eC1hcm0ta2VybmVsCg==
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: rockchip: fix uninitialized variable use
2016-09-22 9:39 [PATCH] PCI: rockchip: fix uninitialized variable use Arnd Bergmann
2016-09-22 17:15 ` Brian Norris
2016-09-23 0:15 ` Shawn Lin
@ 2016-09-28 16:59 ` Bjorn Helgaas
2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2016-09-28 16:59 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bjorn Helgaas, Wenrui Li, Heiko Stuebner, linux-pci, Shawn Lin,
Brian Norris, linux-kernel, linux-rockchip, linux-arm-kernel
On Thu, Sep 22, 2016 at 11:39:59AM +0200, Arnd Bergmann wrote:
> The newly added pcie-rockchip driver fails to initialize the
> io_size variable if the DT doesn't provide ranges for the PCI
> I/O space, as found by building it with -Wmaybe-uninitialized:
>
> drivers/pci/host/pcie-rockchip.c: In function 'rockchip_pcie_probe':
> drivers/pci/host/pcie-rockchip.c:1007:6: warning: 'io_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> This adds an appropriate initialization immediately in front of
> the loop, so the io_size is zero as expected afterwards for that
> case.
>
> Fixes: abe17181b16f ("PCI: rockchip: Add Rockchip PCIe controller support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks, I folded this into the original commit and added a note that it's
from you.
> ---
> drivers/pci/host/pcie-rockchip.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> index c3593e633ccd..8bedc1e1ef80 100644
> --- a/drivers/pci/host/pcie-rockchip.c
> +++ b/drivers/pci/host/pcie-rockchip.c
> @@ -1078,6 +1078,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> goto err_vpcie;
>
> /* Get the I/O and memory ranges from DT */
> + io_size = 0;
> resource_list_for_each_entry(win, &res) {
> switch (resource_type(win->res)) {
> case IORESOURCE_IO:
> --
> 2.9.0
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-28 17:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-22 9:39 [PATCH] PCI: rockchip: fix uninitialized variable use Arnd Bergmann
2016-09-22 17:15 ` Brian Norris
2016-09-23 0:15 ` Shawn Lin
2016-09-28 16:59 ` Bjorn Helgaas
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).