mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ronit Halder <ronit.crj@gmail.com>
To: thomas.petazzoni@free-electrons.com
Cc: noralf@tronnes.org, gregkh@linuxfoundation.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Ronit Halder <ronit.crj@gmail.com>
Subject: [PATCH] Staging: fbtft: Fix iomem dereference
Date: Tue, 18 Aug 2015 12:16:57 +0530	[thread overview]
Message-ID: <1439880417-15675-1-git-send-email-ronit.crj@gmail.com> (raw)

This patch fixes the warning generated by sparse
"cast removes address space of expression" by using ioread16
function insted of directly dereferencing I/O memory.

Signed-off-by: Ronit halder <ronit.crj@gmail.com>
---
 drivers/staging/fbtft/fb_agm1264k-fl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c
index 94dd49c..59826a4 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -273,7 +273,7 @@ construct_line_bitmap(struct fbtft_par *par, u8 *dest, signed short *src,
 
 static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
 {
-	u16 *vmem16 = (u16 *)par->info->screen_base;
+	void __iomem *vmem16 = (u16 __iomem *)par->info->screen_base;
 	u8 *buf = par->txbuf.buf;
 	int x, y;
 	int ret = 0;
@@ -290,7 +290,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
 	/* converting to grayscale16 */
 	for (x = 0; x < par->info->var.xres; ++x)
 		for (y = 0; y < par->info->var.yres; ++y) {
-			u16 pixel = vmem16[y *  par->info->var.xres + x];
+			u16 pixel = ioread16(vmem16 +
+				y * par->info->var.xres + x);
 			u16 b = pixel & 0x1f;
 			u16 g = (pixel & (0x3f << 5)) >> 5;
 			u16 r = (pixel & (0x1f << (5 + 6))) >> (5 + 6);
-- 
2.4.0.GIT


             reply	other threads:[~2015-08-18  6:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18  6:46 Ronit Halder [this message]
2015-08-18  8:57 ` Dan Carpenter
2015-08-18 13:38   ` Ronit Halder

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=1439880417-15675-1-git-send-email-ronit.crj@gmail.com \
    --to=ronit.crj@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noralf@tronnes.org \
    --cc=thomas.petazzoni@free-electrons.com \
    /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

Powered by JetHome