Commit 4496bf25 authored by YueHaibing's avatar YueHaibing Committed by Felipe Balbi

usb: gadget: bcm63xx_udc: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 2e78dd51
...@@ -2282,7 +2282,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev) ...@@ -2282,7 +2282,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct bcm63xx_usbd_platform_data *pd = dev_get_platdata(dev); struct bcm63xx_usbd_platform_data *pd = dev_get_platdata(dev);
struct bcm63xx_udc *udc; struct bcm63xx_udc *udc;
struct resource *res;
int rc = -ENOMEM, i, irq; int rc = -ENOMEM, i, irq;
udc = devm_kzalloc(dev, sizeof(*udc), GFP_KERNEL); udc = devm_kzalloc(dev, sizeof(*udc), GFP_KERNEL);
...@@ -2298,13 +2297,11 @@ static int bcm63xx_udc_probe(struct platform_device *pdev) ...@@ -2298,13 +2297,11 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); udc->usbd_regs = devm_platform_ioremap_resource(pdev, 0);
udc->usbd_regs = devm_ioremap_resource(dev, res);
if (IS_ERR(udc->usbd_regs)) if (IS_ERR(udc->usbd_regs))
return PTR_ERR(udc->usbd_regs); return PTR_ERR(udc->usbd_regs);
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); udc->iudma_regs = devm_platform_ioremap_resource(pdev, 1);
udc->iudma_regs = devm_ioremap_resource(dev, res);
if (IS_ERR(udc->iudma_regs)) if (IS_ERR(udc->iudma_regs))
return PTR_ERR(udc->iudma_regs); return PTR_ERR(udc->iudma_regs);
......
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