Skip to contentSkip to conversation

nand: denali: remove undefined GFP_DMA flag

PATCH In review Enrico Jorns 3 participants 4 messages Nov 14, 2018 – Nov 19, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nand: denali: remove undefined GFP_DMA flag

This was a remnant from porting kernel code to barebox. While being uncritical so far, this will now cause a compiler error since kzalloc is not a define but a static inline function.

As the kzalloc() 'mode' argument was ignored before and still will be, it is safe to remove the parameter.

---
 drivers/mtd/nand/nand_denali.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/nand_denali.c +1 -1
index 8b09b3722f..ef3395864c 100644
@@ -1387,7 +1387,7 @@ int denali_init(struct denali_nand_info *denali)
 	}
 
 	/* allocate a temporary buffer for nand_scan_ident() */
-	denali->buf.buf = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL);
+	denali->buf.buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!denali->buf.buf)
 		return -ENOMEM;
 
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 18 lines · Enrico Jorns

This was a remnant from porting kernel code to barebox. While being uncritical so far, this will now cause a compiler error since kzalloc is not a define but a static inline function.

As the kzalloc() 'mode' argument was ignored before and still will be, it is safe to remove the parameter.

---
 drivers/mtd/nand/nand_denali.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/nand_denali.c +0 -0
index 8b09b3722f..ef3395864c 100644

drivers/mtd/nand/nand_denali.c int denali_init(struct denali_nand_info *denali) · line 1392

Quoted 7 lines
drivers/mtd/nand/nand_denali.c +1 -1
@@ -1387,7 +1387,7 @@ int denali_init(struct denali_nand_info *denali)
        }
 
        /* allocate a temporary buffer for nand_scan_ident() */
-       denali->buf.buf = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL);
+       denali->buf.buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
        if (!denali->buf.buf)
                return -ENOMEM;

Just as a suggestion, maybe just replace this call with xzalloc, getting rid of meaningless GFP_KERNEL as well, and dropping the OOM check below?

Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw
Quoted 21 lines · Andrey Smirnov
Quoted 20 lines · Enrico Jorns

This was a remnant from porting kernel code to barebox. While being uncritical so far, this will now cause a compiler error since kzalloc is not a define but a static inline function.

As the kzalloc() 'mode' argument was ignored before and still will be, it is safe to remove the parameter.

---
  drivers/mtd/nand/nand_denali.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/nand_denali.c +0 -0
index 8b09b3722f..ef3395864c 100644
@@ -1387,7 +1387,7 @@ int denali_init(struct denali_nand_info *denali)
         }
 
Quoted 9 lines

drivers/mtd/nand/nand_denali.c int denali_init(struct denali_nand_info *denali) · line 1392

Quoted 5 lines
drivers/mtd/nand/nand_denali.c +1 -1
         /* allocate a temporary buffer for nand_scan_ident() */
-       denali->buf.buf = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL);
+       denali->buf.buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
         if (!denali->buf.buf)
                 return -ENOMEM;

Just as a suggestion, maybe just replace this call with xzalloc, getting rid of meaningless GFP_KERNEL as well, and dropping the OOM check below?

Since kzalloc() is not a macro to xzalloc() anymore but uses calloc() instead, which actually may return NULL, I am not sure if this is a better approach. But I am not that deep into the topic of differences between *alloc calls to definitely decide that.

Regards, Enrico

Signature · 10 lines
Pengutronix e.K.                           | Enrico Jörns                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5080 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
In reply to Enrico Jorns
Quoted 17 lines · Enrico Jorns

This was a remnant from porting kernel code to barebox. While being uncritical so far, this will now cause a compiler error since kzalloc is not a define but a static inline function.

As the kzalloc() 'mode' argument was ignored before and still will be, it is safe to remove the parameter.

---
 drivers/mtd/nand/nand_denali.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/nand_denali.c +0 -0
index 8b09b3722f..ef3395864c 100644

drivers/mtd/nand/nand_denali.c int denali_init(struct denali_nand_info *denali) · line 1390

Quoted 5 lines
drivers/mtd/nand/nand_denali.c +1 -1
@@ -1387,7 +1387,7 @@ int denali_init(struct denali_nand_info *denali)
 	}
 
 	/* allocate a temporary buffer for nand_scan_ident() */
-	denali->buf.buf = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL);
+	denali->buf.buf = kzalloc(PAGE_SIZE, GFP_KERNEL);

It's fine the way it is. The driver is from the Kernel, uses kzalloc in other places, so fine to do so here aswell.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox