From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936612AbcIWAPQ (ORCPT ); Thu, 22 Sep 2016 20:15:16 -0400 Received: from lucky1.263xmail.com ([211.157.147.133]:55042 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933315AbcIWAPN (ORCPT ); Thu, 22 Sep 2016 20:15:13 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED4: 1 X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <20932106387fa3c71aba37bcf9f3da10> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: Re: [PATCH] PCI: rockchip: fix uninitialized variable use To: Arnd Bergmann , Bjorn Helgaas References: <20160922094018.2138640-1-arnd@arndb.de> Cc: shawn.lin@rock-chips.com, Wenrui Li , Heiko Stuebner , Brian Norris , linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Shawn Lin Message-ID: <440300d4-1d96-4f38-870b-c026b8fb5b2c@rock-chips.com> Date: Fri, 23 Sep 2016 08:15:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20160922094018.2138640-1-arnd@arndb.de> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, ÔÚ 2016/9/22 17:39, Arnd Bergmann дµÀ: > 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] > Seems like we miss this when refactoring the code a bit. Thanks for fixing it. Acked-by: Shawn Lin > 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 > --- > 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: > -- Best Regards Shawn Lin