Skip to contentSkip to conversation

dm: use newly added linux/compat alloc functions

PATCH In review Maxim Moskalets 2 participants 2 messages May 15, 2024 – Jun 10, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: use newly added linux/compat alloc functions

---
 include/dm/devres.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
include/dm/devres.h +2 -6
index 697534aa5b..27761deb6d 100644
@@ -266,17 +266,13 @@ static inline void *devm_kzalloc(struct udevice *dev, size_t size, gfp_t gfp)
 static inline void *devm_kmalloc_array(struct udevice *dev,
 				       size_t n, size_t size, gfp_t flags)
 {
-	/* TODO: add kmalloc_array() to linux/compat.h */
-	if (size != 0 && n > SIZE_MAX / size)
-		return NULL;
-	return kmalloc(n * size, flags);
+	return kmalloc_array(n, size, flags);
 }
 
 static inline void *devm_kcalloc(struct udevice *dev,
 				 size_t n, size_t size, gfp_t flags)
 {
-	/* TODO: add kcalloc() to linux/compat.h */
-	return kmalloc(n * size, flags | __GFP_ZERO);
+	return kcalloc(n, size, flags);
 }
 
 static inline void devm_kfree(struct udevice *dev, void *ptr)
Signature · 1 line
2.39.2
#1 lore raw
Quoted 1 line · Maxim Moskalets

Applied to u-boot/next, thanks!

Signature · 1 line
Tom