From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: tzungbi@kernel.org, jthies@google.com, pmalani@chromium.org,
akuchynski@google.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 3/8] usb: typec: intel_pmc_mux: Null check before use
Date: Thu, 26 Sep 2024 17:37:01 +0300 [thread overview]
Message-ID: <ZvVxjTcfG0Gm-mmB@kuha.fi.intel.com> (raw)
In-Reply-To: <20240925092505.3.Ib7a83adb069df1cb0a40dcddff29618bf3255700@changeid>
On Wed, Sep 25, 2024 at 09:25:04AM -0700, Abhishek Pandit-Subedi wrote:
> Make sure the data pointer in typec_mux_state is not null before
> accessing it.
This really should not be necessary.
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
>
> drivers/usb/typec/mux/intel_pmc_mux.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
> index 56989a0d0f43..4283fead9a69 100644
> --- a/drivers/usb/typec/mux/intel_pmc_mux.c
> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c
> @@ -331,14 +331,19 @@ static int
> pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
> {
> struct typec_thunderbolt_data *data = state->data;
> - u8 cable_rounded = TBT_CABLE_ROUNDED_SUPPORT(data->cable_mode);
> - u8 cable_speed = TBT_CABLE_SPEED(data->cable_mode);
> + u8 cable_rounded, cable_speed;
> struct altmode_req req = { };
>
> + if (!data)
> + return 0;
> +
> if (IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) ||
> IOM_PORT_ACTIVITY_IS(port->iom_status, ALT_MODE_TBT_USB))
> return 0;
>
> + cable_rounded = TBT_CABLE_ROUNDED_SUPPORT(data->cable_mode);
> + cable_speed = TBT_CABLE_SPEED(data->cable_mode);
> +
> req.usage = PMC_USB_ALT_MODE;
> req.usage |= port->usb3_port << PMC_USB_MSG_USB3_PORT_SHIFT;
> req.mode_type = PMC_USB_MODE_TYPE_TBT << PMC_USB_MODE_TYPE_SHIFT;
> --
> 2.46.0.792.g87dc391469-goog
--
heikki
next prev parent reply other threads:[~2024-09-26 14:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 16:25 [PATCH 0/8] Thunderbolt and DP altmode support for cros-ec-typec Abhishek Pandit-Subedi
2024-09-25 16:25 ` [PATCH 1/8] usb: typec: Add driver for Thunderbolt 3 Alternate Mode Abhishek Pandit-Subedi
2024-09-26 14:06 ` Heikki Krogerus
2024-09-26 15:14 ` kernel test robot
2024-09-25 16:25 ` [PATCH 2/8] usb: typec: altmode_match should handle TYPEC_ANY_MODE Abhishek Pandit-Subedi
2024-09-25 16:54 ` Dmitry Baryshkov
2024-09-25 17:31 ` Abhishek Pandit-Subedi
2024-09-26 14:35 ` Heikki Krogerus
2024-09-25 16:25 ` [PATCH 3/8] usb: typec: intel_pmc_mux: Null check before use Abhishek Pandit-Subedi
2024-09-25 16:54 ` Dmitry Baryshkov
2024-09-25 17:29 ` Abhishek Pandit-Subedi
2024-09-26 14:37 ` Heikki Krogerus [this message]
2024-09-25 16:25 ` [PATCH 4/8] usb: typec: Auto enter control for alternate modes Abhishek Pandit-Subedi
2024-09-25 16:25 ` [PATCH 5/8] platform/chrome: cros_ec_typec: Update partner altmode active Abhishek Pandit-Subedi
2024-09-26 14:48 ` Heikki Krogerus
2024-09-25 16:25 ` [PATCH 6/8] platform/chrome: cros_ec_typec: Displayport support Abhishek Pandit-Subedi
2024-09-26 14:39 ` Heikki Krogerus
2024-09-27 9:07 ` Dmitry Baryshkov
2024-09-28 4:27 ` kernel test robot
2024-09-25 16:25 ` [PATCH 7/8] platform/chrome: cros_ec_typec: Thunderbolt support Abhishek Pandit-Subedi
2024-09-25 17:13 ` Dmitry Baryshkov
2024-09-25 18:42 ` Abhishek Pandit-Subedi
2024-09-25 21:20 ` Dmitry Baryshkov
2024-09-25 21:35 ` Abhishek Pandit-Subedi
2024-09-26 14:32 ` kernel test robot
2024-09-27 7:34 ` kernel test robot
2024-09-25 16:25 ` [PATCH 8/8] platform/chrome: cros_ec_typec: Disable auto_enter Abhishek Pandit-Subedi
2024-09-25 17:03 ` Dmitry Baryshkov
2024-09-25 17:39 ` Abhishek Pandit-Subedi
2024-09-25 21:24 ` Dmitry Baryshkov
2024-09-25 21:35 ` Abhishek Pandit-Subedi
2024-09-25 21:43 ` Dmitry Baryshkov
2024-09-25 17:12 ` [PATCH 0/8] Thunderbolt and DP altmode support for cros-ec-typec Dmitry Baryshkov
2024-09-25 17:20 ` Abhishek Pandit-Subedi
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=ZvVxjTcfG0Gm-mmB@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=abhishekpandit@chromium.org \
--cc=akuchynski@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jthies@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pmalani@chromium.org \
--cc=tzungbi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox