Hello! On 12/15/2018 09:10 PM, Alexander Shiyan wrote: > Use devm_ioremap_resource() calls. > This will provide a more reasonable exit codes in case of errors. Why -ENOMEM is not enough for you? > Signed-off-by: Alexander Shiyan <shc_work@xxxxxxx> > --- > drivers/ata/pata_platform.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c > index d6f8f54..873150c 100644 > --- a/drivers/ata/pata_platform.c > +++ b/drivers/ata/pata_platform.c > @@ -147,19 +147,21 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res, > * Handle the MMIO case > */ > if (mmio) { > - ap->ioaddr.cmd_addr = devm_ioremap(dev, io_res->start, > - resource_size(io_res)); > - ap->ioaddr.ctl_addr = devm_ioremap(dev, ctl_res->start, > - resource_size(ctl_res)); > + ap->ioaddr.cmd_addr = devm_ioremap_resource(dev, io_res); > + if (IS_ERR(ap->ioaddr.cmd_addr)) > + return PTR_ERR(ap->ioaddr.cmd_addr); > + ap->ioaddr.ctl_addr = devm_ioremap_resource(dev, ctl_res); > + if (IS_ERR(ap->ioaddr.ctl_addr)) > + return PTR_ERR(ap->ioaddr.ctl_addr); > } else { > ap->ioaddr.cmd_addr = devm_ioport_map(dev, io_res->start, > resource_size(io_res)); > ap->ioaddr.ctl_addr = devm_ioport_map(dev, ctl_res->start, > resource_size(ctl_res)); > - } > - if (!ap->ioaddr.cmd_addr || !ap->ioaddr.ctl_addr) { > - dev_err(dev, "failed to map IO/CTL base\n"); > - return -ENOMEM; > + if (!ap->ioaddr.cmd_addr || !ap->ioaddr.ctl_addr) { > + dev_err(dev, "failed to map IO/CTL base\n"); > + return -ENOMEM; > + } Note the "imbalance" you're introducing: for MMIO request_mem_region() is called now (by devm_ioremap_resource(), while for I/O porst request_region() is not. [...] MBR, Sergei