[PATCH master 09/13] usb: typec: fix compile test with CONFIG_SANDBOX

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Oct 14 04:39:08 PDT 2024


Compiling the file triggers errors about kmalloc and ARRAY_SIZE being
undefined. As we don't require kmalloc's alignment here, switch it to
a normal malloc and include <linux/kernel.h> for the ARRAY_SIZE
definition.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/usb/typec/class.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 7f498550f80e..495ac794622f 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -8,6 +8,7 @@
 
 #include <module.h>
 #include <driver.h>
+#include <linux/kernel.h>
 #include <linux/usb/role.h>
 #include <linux/usb/typec.h>
 #include <linux/usb/typec_altmode.h>
@@ -141,7 +142,7 @@ struct typec_port *typec_register_port(struct device *parent,
 	const char *alias;
 	int ret;
 
-	port = kzalloc(sizeof(*port), GFP_KERNEL);
+	port = malloc(sizeof(*port));
 	if (!port)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.39.5




More information about the barebox mailing list