On Mon, Jan 22, 2018 at 06:53:38PM +0300, Sergei Shtylyov wrote: > On 01/22/2018 06:44 PM, Ladislav Michl wrote: > > >>> As devm_ioremap_resource() checks for valid resource, > >>> make use of it instead of testing ourselves. As a bonus > >>> memory region is requested. > >>> > >>> Signed-off-by: Ladislav Michl <ladis@xxxxxxxxxxxxxx> > >>> --- > >>> drivers/usb/gadget/udc/atmel_usba_udc.c | 40 ++++++++++++++++----------------- > >>> 1 file changed, 19 insertions(+), 21 deletions(-) > >>> > >>> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c > >>> index 075eaaa8a408..403e06e7175f 100644 > >>> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c > >>> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c > >> [...] > >>> @@ -2284,10 +2284,24 @@ static int usba_udc_probe(struct platform_device *pdev) > >>> udc->gadget = usba_gadget_template; > >>> INIT_LIST_HEAD(&udc->gadget.ep_list); > >>> > >>> - regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID); > >>> - fifo = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID); > >>> - if (!regs || !fifo) > >>> - return -ENXIO; > >>> + res = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID); > >>> + udc->regs = devm_ioremap_resource(&pdev->dev, res); > >>> + if (IS_ERR(udc->regs)) { > >>> + ret = PTR_ERR(udc->regs); > >>> + dev_err(&pdev->dev, "Unable to map I/O memory: %d\n", ret); > >> > >> devm_ioremap_resource() prints out the error message. > > > > It does, indeed. However I left both error messages here to distinguish > > between I/O and FIFO failures. > > Well, I'm seeing the successfully remapped resource being dumped below, so you can judge the probing progress by that message (and the resource dump done by devm_ioremap_resource())... but if you feel that not enough, OK, leave it as is... I feel convinced and v2 will follow :-) -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html