mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] driver/memmap: fix generic_memmap_rw and generic_memmap_ro
Date: Thu, 10 Feb 2011 04:31:59 +0100	[thread overview]
Message-ID: <1297308720-26390-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1297308720-26390-1-git-send-email-plagnioj@jcrosoft.com>

we check before the RW access for generic_memmap_ro instead of
generic_memmap_rw

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/base/driver.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index ff92e44..bd7464e 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -223,8 +223,6 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags)
 	if (!cdev->dev)
 		return -EINVAL;
 
-	if (flags & PROT_WRITE)
-		return -EACCES;
 	*map = (void *)cdev->dev->map_base;
 	return 0;
 }
@@ -234,6 +232,9 @@ int generic_memmap_rw(struct cdev *cdev, void **map, int flags)
 	if (!cdev->dev)
 		return -EINVAL;
 
+	if (flags & PROT_WRITE)
+		return -EACCES;
+
 	*map = (void *)cdev->dev->map_base;
 	return 0;
 }
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-02-10  3:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10  3:31 [PATCH 1/4] bus: remove dead code Jean-Christophe PLAGNIOL-VILLARD
2011-02-10  3:31 ` [PATCH 2/4] bus/driver: move from lib to drivers/base Jean-Christophe PLAGNIOL-VILLARD
2011-02-10  3:31 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-02-10  7:12   ` [PATCH 3/4] driver/memmap: fix generic_memmap_rw and generic_memmap_ro Sascha Hauer
2011-02-10 11:50     ` Jean-Christophe PLAGNIOL-VILLARD
2011-02-10 12:01       ` Sascha Hauer
2011-02-10  3:32 ` [PATCH 4/4] devices_shutdown: move remove call to bus Jean-Christophe PLAGNIOL-VILLARD

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=1297308720-26390-3-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.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