diff mbox series

[u-boot,03/14] mtd: rawnand: omap_gpmc: Fix build warning on 64-bit platforms

Message ID 20221011115012.6181-4-rogerq@kernel.org
State Accepted, archived
Commit 7e4a494c5f676c7a16a28ac36b9fdbd84022a400
Delegated to: Dario Binacchi
Headers show
Series rawnand: omap_gpmc: driver model support | expand

Commit Message

Roger Quadros Oct. 11, 2022, 11:50 a.m. UTC
Pointer size cannot be assumed to be 32-bit, so use
use uintptr_t instead of uint32_t.

Fixes the below build warning on 64-bit builds.

drivers/mtd/nand/raw/omap_gpmc.c:439:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  head = ((uint32_t) buf) % 4;

Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
 drivers/mtd/nand/raw/omap_gpmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Nazzareno Trimarchi Oct. 15, 2022, 5:53 a.m. UTC | #1
On Tue, Oct 11, 2022 at 1:50 PM Roger Quadros <rogerq@kernel.org> wrote:
>
> Pointer size cannot be assumed to be 32-bit, so use
> use uintptr_t instead of uint32_t.
>
> Fixes the below build warning on 64-bit builds.
>
> drivers/mtd/nand/raw/omap_gpmc.c:439:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>   head = ((uint32_t) buf) % 4;
>
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> ---
>  drivers/mtd/nand/raw/omap_gpmc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/omap_gpmc.c b/drivers/mtd/nand/raw/omap_gpmc.c
> index 7e9ccf7878..d62c3e6fce 100644
> --- a/drivers/mtd/nand/raw/omap_gpmc.c
> +++ b/drivers/mtd/nand/raw/omap_gpmc.c
> @@ -438,14 +438,14 @@ static inline void omap_nand_read(struct mtd_info *mtd, uint8_t *buf, int len)
>  static void omap_nand_read_prefetch(struct mtd_info *mtd, uint8_t *buf, int len)
>  {
>         int ret;
> -       uint32_t head, tail;
> +       uintptr_t head, tail;
>         struct nand_chip *chip = mtd_to_nand(mtd);
>
>         /*
>          * If the destination buffer is unaligned, start with reading
>          * the overlap byte-wise.
>          */
> -       head = ((uint32_t) buf) % 4;
> +       head = ((uintptr_t)buf) % 4;
>         if (head) {
>                 omap_nand_read(mtd, buf, head);
>                 buf += head;
> --
> 2.17.1
>

Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>

Michael
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/omap_gpmc.c b/drivers/mtd/nand/raw/omap_gpmc.c
index 7e9ccf7878..d62c3e6fce 100644
--- a/drivers/mtd/nand/raw/omap_gpmc.c
+++ b/drivers/mtd/nand/raw/omap_gpmc.c
@@ -438,14 +438,14 @@  static inline void omap_nand_read(struct mtd_info *mtd, uint8_t *buf, int len)
 static void omap_nand_read_prefetch(struct mtd_info *mtd, uint8_t *buf, int len)
 {
 	int ret;
-	uint32_t head, tail;
+	uintptr_t head, tail;
 	struct nand_chip *chip = mtd_to_nand(mtd);
 
 	/*
 	 * If the destination buffer is unaligned, start with reading
 	 * the overlap byte-wise.
 	 */
-	head = ((uint32_t) buf) % 4;
+	head = ((uintptr_t)buf) % 4;
 	if (head) {
 		omap_nand_read(mtd, buf, head);
 		buf += head;