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

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
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -3135,14 +3135,10 @@ 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);

	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);

+1 −4
Original line number Diff line number Diff line
@@ -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;