From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] USB: typec: fix const issue in typec_match()
Date: Thu, 22 May 2025 15:05:51 +0300 [thread overview]
Message-ID: <aC8TH03vOhXI9IYW@kuha.fi.intel.com> (raw)
In-Reply-To: <2025052126-scholar-stainless-ad55@gregkh>
Hi Greg,
On Wed, May 21, 2025 at 03:41:27PM +0200, Greg Kroah-Hartman wrote:
> 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>
Shouldn't there be a Fixes tag? git blame gives commit d69d804845985
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
thanks,
> ---
> drivers/usb/typec/bus.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> 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++)
> --
> 2.49.0
>
--
heikki
next prev parent reply other threads:[~2025-05-22 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 13:41 [PATCH] USB: typec: fix const issue in typec_match() Greg Kroah-Hartman
2025-05-22 12:05 ` Heikki Krogerus [this message]
2025-05-22 12:30 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aC8TH03vOhXI9IYW@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.