diff mbox series

usb: gadget: net2272: skip BAR1 on error handling paths in probe

Message ID 20200715164009.32341-1-novikov@ispras.ru (mailing list archive)
State Mainlined
Commit ae90cc8237bf4ee416a326c51052ddcc7918ee43
Headers show
Series usb: gadget: net2272: skip BAR1 on error handling paths in probe | expand

Commit Message

Evgeny Novikov July 15, 2020, 4:40 p.m. UTC
net2272_rdk1_probe() skips "i == 1" (BAR1) during allocation of
resources. The patch does this on error hanling paths as well.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
---
 drivers/usb/gadget/udc/net2272.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
index 928057b206f1..639631d44b00 100644
--- a/drivers/usb/gadget/udc/net2272.c
+++ b/drivers/usb/gadget/udc/net2272.c
@@ -2370,6 +2370,8 @@  net2272_rdk1_probe(struct pci_dev *pdev, struct net2272 *dev)
 
  err:
 	while (--i >= 0) {
+		if (i == 1)
+			continue;	/* BAR1 unused */
 		iounmap(mem_mapped_addr[i]);
 		release_mem_region(pci_resource_start(pdev, i),
 			pci_resource_len(pdev, i));