diff mbox series

USB: typec: fix const issue in typec_match()

Message ID 2025052126-scholar-stainless-ad55@gregkh
State New
Headers show
Series USB: typec: fix const issue in typec_match() | expand

Commit Message

Greg Kroah-Hartman May 21, 2025, 1:41 p.m. UTC
typec_match() takes a const pointer, and then decides to cast it away
into a non-const one, which is not a good thing to do overall.  Fix this
up by properly setting the pointers to be const to preserve that
attribute.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/typec/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c
index ae90688d23e4..91eae95d6fa4 100644
--- a/drivers/usb/typec/bus.c
+++ b/drivers/usb/typec/bus.c
@@ -449,8 +449,8 @@  ATTRIBUTE_GROUPS(typec);
 
 static int typec_match(struct device *dev, const struct device_driver *driver)
 {
-	struct typec_altmode_driver *drv = to_altmode_driver(driver);
-	struct typec_altmode *altmode = to_typec_altmode(dev);
+	const struct typec_altmode_driver *drv = to_altmode_driver(driver);
+	const struct typec_altmode *altmode = to_typec_altmode(dev);
 	const struct typec_device_id *id;
 
 	for (id = drv->id_table; id->svid; id++)