Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752343AbbHRGrV (ORCPT ); Tue, 18 Aug 2015 02:47:21 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35014 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751258AbbHRGrU (ORCPT ); Tue, 18 Aug 2015 02:47:20 -0400 From: Ronit Halder To: thomas.petazzoni@free-electrons.com Cc: noralf@tronnes.org, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Ronit Halder Subject: [PATCH] Staging: fbtft: Fix iomem dereference Date: Tue, 18 Aug 2015 12:16:57 +0530 Message-Id: <1439880417-15675-1-git-send-email-ronit.crj@gmail.com> X-Mailer: git-send-email 2.4.0.GIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1588 Lines: 40 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/