diff mbox

[U-Boot] pci: Fix compiler warnings in dm_pciauto_setup_device()

Message ID 1455779687-29776-1-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit 6796704b0dfb4f98cb4a026988e9739884812b5c
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng Feb. 18, 2016, 7:14 a.m. UTC
Fix the following compiler warnings when DEBUG is on.

warning: 'bar_res' may be used uninitialized in this function.
drivers/pci/pci_auto.c:101:21:
   if (!enum_only && pciauto_region_allocate(bar_res, bar_size,
                        ^

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/pci/pci_auto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Feb. 19, 2016, 8:55 p.m. UTC | #1
On 18 February 2016 at 00:14, Bin Meng <bmeng.cn@gmail.com> wrote:
> Fix the following compiler warnings when DEBUG is on.
>
> warning: 'bar_res' may be used uninitialized in this function.
> drivers/pci/pci_auto.c:101:21:
>    if (!enum_only && pciauto_region_allocate(bar_res, bar_size,
>                         ^
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/pci/pci_auto.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Feb. 26, 2016, 5:13 p.m. UTC | #2
On 19 February 2016 at 13:55, Simon Glass <sjg@chromium.org> wrote:
> On 18 February 2016 at 00:14, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Fix the following compiler warnings when DEBUG is on.
>>
>> warning: 'bar_res' may be used uninitialized in this function.
>> drivers/pci/pci_auto.c:101:21:
>>    if (!enum_only && pciauto_region_allocate(bar_res, bar_size,
>>                         ^
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  drivers/pci/pci_auto.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
index 88bc416..ee9a854 100644
--- a/drivers/pci/pci_auto.c
+++ b/drivers/pci/pci_auto.c
@@ -30,7 +30,7 @@  void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
 	u8 header_type;
 	int rom_addr;
 	pci_addr_t bar_value;
-	struct pci_region *bar_res;
+	struct pci_region *bar_res = NULL;
 	int found_mem64 = 0;
 	u16 class;