Skip to contentSkip to conversation

uio: make read-only const array porttypes static

PATCH New Colin Ian King 1 participant 1 message Jul 14

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

PATCH 1/1 uio: make read-only const array porttypes static

Don't populate the read-only const array porttypes on the stack at run time, instead make it static const char * const

---
 drivers/uio/uio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/uio/uio.c +1 -1
index 1e4ade78ed84..981f8d21daad 100644
@@ -150,7 +150,7 @@ static ssize_t portio_size_show(struct uio_port *port, char *buf)
 
 static ssize_t portio_porttype_show(struct uio_port *port, char *buf)
 {
-	const char *porttypes[] = {"none", "x86", "gpio", "other"};
+	static const char * const porttypes[] = {"none", "x86", "gpio", "other"};
 
 	if ((port->porttype < 0) || (port->porttype > UIO_PORT_OTHER))
 		return -EINVAL;
Signature · 1 line
2.53.0