linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: linux-ide@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Alexander Shiyan <shc_work@mail.ru>
Subject: [PATCH 3/4] pata_platform: Use devm_ioremap_resource()
Date: Sat, 23 Aug 2014 14:46:11 +0400	[thread overview]
Message-ID: <1408790772-5305-2-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1408790772-5305-1-git-send-email-shc_work@mail.ru>

Use devm_ioremap_resource() calls.
This will provide a more reasonable exit codes in case of errors.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 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 f8cff3e..ecbc3bf 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -145,19 +145,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;
+		}
 	}
 
 	ap->ioaddr.altstatus_addr = ap->ioaddr.ctl_addr;
-- 
1.8.5.5


  reply	other threads:[~2014-08-23 10:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-23 10:46 [PATCH 1/4] pata_of_platform: Remove "electra-ide" quirk Alexander Shiyan
2014-08-23 10:46 ` Alexander Shiyan [this message]
2014-08-23 16:58   ` [PATCH 3/4] pata_platform: Use devm_ioremap_resource() Tejun Heo
2014-08-23 10:46 ` [PATCH 4/4] pata_platform: Use 16-bit wide data transfer Alexander Shiyan
2014-08-23 16:53   ` Tejun Heo
2014-08-23 17:29     ` Alexander Shiyan
2014-08-25 19:34       ` Tejun Heo
2014-08-25 19:48         ` One Thousand Gnomes
2014-08-26  8:55           ` Alexander Shiyan
2014-09-18 16:40           ` Alexander Shiyan
2014-09-18 17:29             ` Tejun Heo
2014-08-23 17:06 ` [PATCH 1/4] pata_of_platform: Remove "electra-ide" quirk Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408790772-5305-2-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=linux-ide@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).