Commit 76c3727d authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Felipe Balbi

usb: gadget: amd5536udc: remove unnecessary conditions

The condition checking for irq_registered, regs, mem_region and active
are not required as this is the remove function. And we are in the
remove means that probe was successful and they can never be NULL at
this point of code.
It was required in the original code as the remove function was part of
the error handler of probe function.
Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent f349dd3c
......@@ -3135,15 +3135,11 @@ static void udc_pci_remove(struct pci_dev *pdev)
/* reset controller */
writel(AMD_BIT(UDC_DEVCFG_SOFTRESET), &dev->regs->cfg);
if (dev->irq_registered)
free_irq(pdev->irq, dev);
if (dev->virt_addr)
iounmap(dev->virt_addr);
if (dev->mem_region)
release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
if (dev->active)
pci_disable_device(pdev);
free_irq(pdev->irq, dev);
iounmap(dev->virt_addr);
release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
pci_disable_device(pdev);
udc_remove(dev);
}
......@@ -3240,7 +3236,6 @@ static int udc_pci_probe(
retval = -ENODEV;
goto err_pcidev;
}
dev->active = 1;
/* PCI resource allocation */
resource = pci_resource_start(pdev, 0);
......@@ -3251,7 +3246,6 @@ static int udc_pci_probe(
retval = -EBUSY;
goto err_memreg;
}
dev->mem_region = 1;
dev->virt_addr = ioremap_nocache(resource, len);
if (dev->virt_addr == NULL) {
......@@ -3282,7 +3276,6 @@ static int udc_pci_probe(
retval = -EBUSY;
goto err_irq;
}
dev->irq_registered = 1;
pci_set_drvdata(pdev, dev);
......
......@@ -526,14 +526,11 @@ struct udc {
struct udc_ep ep[UDC_EP_NUM];
struct usb_gadget_driver *driver;
/* operational flags */
unsigned active : 1,
stall_ep0in : 1,
unsigned stall_ep0in : 1,
waiting_zlp_ack_ep0in : 1,
set_cfg_not_acked : 1,
irq_registered : 1,
data_ep_enabled : 1,
data_ep_queued : 1,
mem_region : 1,
sys_suspended : 1,
connected;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment