Re: [PATCH] staging: mt7621-pci: Fix compiler error 'slot' may be used uninitialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>:

Hi Sergio,

Hi René,

On Fri, Jul 5, 2019 at 10:35 PM René van Dorst <opensource@xxxxxxxxxx> wrote:

In commit 802a2f7b2fe3 ("staging: mt7621-pci: factor out
'mt7621_pcie_enable_port' function"), slot = port->slot; line was removed.
Also other dev_err() print parameter was changed from slot to port->slot.
So the same should be done here.

This also fixes compiler error:
drivers/staging/mt7621-pci/pci-mt7621.c: In function 'mt7621_pci_probe':
./include/linux/device.h:1490:2: warning: 'slot' may be used uninitialized in this function [-Wmaybe-uninitialized]
  _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
  ^~~~~~~~~
drivers/staging/mt7621-pci/pci-mt7621.c:504:6: note: 'slot' was declared here
  u32 slot;
      ^~~~

Fixes: 802a2f7b2fe3 ("staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function")
Signed-off-by: René van Dorst <opensource@xxxxxxxxxx>
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
index 03d919a94552..81600c03cae1 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -511,7 +511,7 @@ static void mt7621_pcie_enable_ports(struct mt7621_pcie *pcie)
                                        port->slot);
                                continue;
                        }
-                       dev_info(dev, "PCIE%d enabled\n", slot);
+                       dev_info(dev, "PCIE%d enabled\n", port->slot);
                        num_slots_enabled++;
                }
        }
--
2.20.1


I don't know what tree and branch are you using for this but this is
kind of old code... You should
use staging git tree, 'staging-next' branch for staging patches to
avoid problems like this.

I am using net-next tree for my mt7621 ethernet development.
So I see this warning a lot.

I didn't know about the staging-next branch.
I think I only checked the master branch.
I see now that the pci driver has changed a lot.

Sorry for the noise.

Greats,

René


Best regards,
    Sergio Paracuellos



_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux