From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Rex Nie <rex.nie@jaguarmicro.com>
Cc: bryan.odonoghue@linaro.org, gregkh@linuxfoundation.org,
linux@roeck-us.net, caleb.connolly@linaro.org,
linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, angus.chen@jaguarmicro.com,
stable@vger.kernel.org
Subject: Re: [PATCH v4] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
Date: Thu, 31 Oct 2024 12:56:01 +0200 [thread overview]
Message-ID: <ZyNiQUKPdUwE8EQZ@kuha.fi.intel.com> (raw)
In-Reply-To: <20241030133632.2116-1-rex.nie@jaguarmicro.com>
On Wed, Oct 30, 2024 at 09:36:32PM +0800, Rex Nie wrote:
> If the read of USB_PDPHY_RX_ACKNOWLEDGE_REG failed, then hdr_len and
> txbuf_len are uninitialized. This commit stops to print uninitialized
> value and misleading/false data.
>
> Cc: stable@vger.kernel.org
> Fixes: a4422ff22142 (" usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
> Signed-off-by: Rex Nie <rex.nie@jaguarmicro.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> V2 -> V3:
> - add changelog, add Fixes tag, add Cc stable ml. Thanks heikki
> - Link to v2: https://lore.kernel.org/all/20241030022753.2045-1-rex.nie@jaguarmicro.com/
> V1 -> V2:
> - keep printout when data didn't transmit, thanks Bjorn, bod, greg k-h
> - Links: https://lore.kernel.org/all/b177e736-e640-47ed-9f1e-ee65971dfc9c@linaro.org/
> ---
> drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
> index 5b7f52b74a40..726423684bae 100644
> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
> @@ -227,6 +227,10 @@ qcom_pmic_typec_pdphy_pd_transmit_payload(struct pmic_typec_pdphy *pmic_typec_pd
>
> spin_lock_irqsave(&pmic_typec_pdphy->lock, flags);
>
> + hdr_len = sizeof(msg->header);
> + txbuf_len = pd_header_cnt_le(msg->header) * 4;
> + txsize_len = hdr_len + txbuf_len - 1;
> +
> ret = regmap_read(pmic_typec_pdphy->regmap,
> pmic_typec_pdphy->base + USB_PDPHY_RX_ACKNOWLEDGE_REG,
> &val);
> @@ -244,10 +248,6 @@ qcom_pmic_typec_pdphy_pd_transmit_payload(struct pmic_typec_pdphy *pmic_typec_pd
> if (ret)
> goto done;
>
> - hdr_len = sizeof(msg->header);
> - txbuf_len = pd_header_cnt_le(msg->header) * 4;
> - txsize_len = hdr_len + txbuf_len - 1;
> -
> /* Write message header sizeof(u16) to USB_PDPHY_TX_BUFFER_HDR_REG */
> ret = regmap_bulk_write(pmic_typec_pdphy->regmap,
> pmic_typec_pdphy->base + USB_PDPHY_TX_BUFFER_HDR_REG,
> --
> 2.17.1
--
heikki
next prev parent reply other threads:[~2024-10-31 10:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 2:18 [PATCH] usb: typec: qcom-pmic: fix uninitialized value hdr_len and txbuf_len Rex Nie
2024-10-29 2:30 ` Greg KH
2024-10-29 6:28 ` 答复: " Rex Nie
2024-10-29 15:28 ` Bjorn Andersson
2024-10-29 15:38 ` Bryan O'Donoghue
2024-10-30 2:27 ` [PATCH v2] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier Rex Nie
2024-10-30 8:39 ` Heikki Krogerus
2024-10-30 10:35 ` 答复: " Rex Nie
2024-10-30 10:32 ` [PATCH v3] " Rex Nie
2024-10-30 12:31 ` Bryan O'Donoghue
2024-10-30 13:19 ` Heikki Krogerus
2024-10-30 13:37 ` 答复: " Rex Nie
2024-10-30 13:36 ` [PATCH v4] " Rex Nie
2024-10-31 10:56 ` Heikki Krogerus [this message]
2024-11-01 15:45 ` Bjorn Andersson
2024-11-02 12:27 ` 答复: " Rex Nie
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=ZyNiQUKPdUwE8EQZ@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=angus.chen@jaguarmicro.com \
--cc=bryan.odonoghue@linaro.org \
--cc=caleb.connolly@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=rex.nie@jaguarmicro.com \
--cc=stable@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.