* Re: [PATCH v2] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
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 13:36 ` [PATCH v4] " Rex Nie
2 siblings, 1 reply; 16+ messages in thread
From: Heikki Krogerus @ 2024-10-30 8:39 UTC (permalink / raw)
To: Rex Nie
Cc: bryan.odonoghue, gregkh, linux-arm-msm, linux-usb, linux-kernel,
angus.chen
Hi,
On Wed, Oct 30, 2024 at 10:27:54AM +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.
>
> Signed-off-by: Rex Nie <rex.nie@jaguarmicro.com>
> ---
You need to include a changelog also for the patch itself here, after
that "---" separator. This patch is also still missing the Fixes tag.
You can read more about how to send the patches from the documentation:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html
So please send v3 with those fixed. Don't forget to Cc the stable ml.:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#select-the-recipients-for-your-patch
thanks,
> 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* 答复: [PATCH v2] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
2024-10-30 8:39 ` Heikki Krogerus
@ 2024-10-30 10:35 ` Rex Nie
0 siblings, 0 replies; 16+ messages in thread
From: Rex Nie @ 2024-10-30 10:35 UTC (permalink / raw)
To: Heikki Krogerus
Cc: bryan.odonoghue@linaro.org, gregkh@linuxfoundation.org,
linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Angus Chen
HI heikki,
Thanks. I will send patch v3 soon.
BRs
Rex
> -----邮件原件-----
> 发件人: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 发送时间: 2024年10月30日 16:39
> 收件人: Rex Nie <rex.nie@jaguarmicro.com>
> 抄送: bryan.odonoghue@linaro.org; gregkh@linuxfoundation.org;
> linux-arm-msm@vger.kernel.org; linux-usb@vger.kernel.org;
> linux-kernel@vger.kernel.org; Angus Chen <angus.chen@jaguarmicro.com>
> 主题: Re: [PATCH v2] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len
> earlier
>
> External Mail: This email originated from OUTSIDE of the organization!
> Do not click links, open attachments or provide ANY information unless you
> recognize the sender and know the content is safe.
>
>
> Hi,
>
> On Wed, Oct 30, 2024 at 10:27:54AM +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.
> >
> > Signed-off-by: Rex Nie <rex.nie@jaguarmicro.com>
> > ---
>
> You need to include a changelog also for the patch itself here, after that "---"
> separator. This patch is also still missing the Fixes tag.
>
> You can read more about how to send the patches from the documentation:
> https://www.kernel.org/doc/html/latest/process/submitting-patches.html
>
> So please send v3 with those fixed. Don't forget to Cc the stable ml.:
> https://www.kernel.org/doc/html/latest/process/submitting-patches.html#s
> elect-the-recipients-for-your-patch
>
> thanks,
>
> > 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
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:32 ` Rex Nie
2024-10-30 12:31 ` Bryan O'Donoghue
2024-10-30 13:19 ` Heikki Krogerus
2024-10-30 13:36 ` [PATCH v4] " Rex Nie
2 siblings, 2 replies; 16+ messages in thread
From: Rex Nie @ 2024-10-30 10:32 UTC (permalink / raw)
To: bryan.odonoghue, heikki.krogerus
Cc: gregkh, linux, caleb.connolly, linux-arm-msm, linux-usb,
linux-kernel, angus.chen, stable, Rex Nie
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.
---
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/
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>
---
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
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v3] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
2024-10-30 10:32 ` [PATCH v3] " Rex Nie
@ 2024-10-30 12:31 ` Bryan O'Donoghue
2024-10-30 13:19 ` Heikki Krogerus
1 sibling, 0 replies; 16+ messages in thread
From: Bryan O'Donoghue @ 2024-10-30 12:31 UTC (permalink / raw)
To: Rex Nie, heikki.krogerus
Cc: gregkh, linux, caleb.connolly, linux-arm-msm, linux-usb,
linux-kernel, angus.chen, stable
On 30/10/2024 10:32, 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.
>
> ---
> 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/
>
> 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>
> ---
> 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,
Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v3] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
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
1 sibling, 1 reply; 16+ messages in thread
From: Heikki Krogerus @ 2024-10-30 13:19 UTC (permalink / raw)
To: Rex Nie
Cc: bryan.odonoghue, gregkh, linux, caleb.connolly, linux-arm-msm,
linux-usb, linux-kernel, angus.chen, stable
On Wed, Oct 30, 2024 at 06:32:57PM +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.
>
> ---
> 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/
>
> 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>
Sorry, but this is still broken.
Those tags need to come before the "---". Otherwise they will not
end-up into the actual commit when this patch is applied.
It should look something like this:
usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
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>
---
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...
thanks,
--
heikki
^ permalink raw reply [flat|nested] 16+ messages in thread* 答复: [PATCH v3] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
2024-10-30 13:19 ` Heikki Krogerus
@ 2024-10-30 13:37 ` Rex Nie
0 siblings, 0 replies; 16+ messages in thread
From: Rex Nie @ 2024-10-30 13:37 UTC (permalink / raw)
To: Heikki Krogerus
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, stable@vger.kernel.org
Thanks again, heikki.
> -----邮件原件-----
> 发件人: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 发送时间: 2024年10月30日 21:20
> 收件人: Rex Nie <rex.nie@jaguarmicro.com>
> 抄送: 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 <angus.chen@jaguarmicro.com>;
> stable@vger.kernel.org
> 主题: Re: [PATCH v3] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len
> earlier
>
> External Mail: This email originated from OUTSIDE of the organization!
> Do not click links, open attachments or provide ANY information unless you
> recognize the sender and know the content is safe.
>
>
> On Wed, Oct 30, 2024 at 06:32:57PM +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.
> >
> > ---
> > 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@linar
> > o.org/
> >
> > 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>
>
> Sorry, but this is still broken.
>
> Those tags need to come before the "---". Otherwise they will not end-up into
> the actual commit when this patch is applied.
>
> It should look something like this:
>
> usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
>
> 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>
> ---
> 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.co
> m/
> 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...
>
> thanks,
>
> --
> heikki
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v4] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
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:32 ` [PATCH v3] " Rex Nie
@ 2024-10-30 13:36 ` Rex Nie
2024-10-31 10:56 ` Heikki Krogerus
2024-11-01 15:45 ` Bjorn Andersson
2 siblings, 2 replies; 16+ messages in thread
From: Rex Nie @ 2024-10-30 13:36 UTC (permalink / raw)
To: bryan.odonoghue, heikki.krogerus
Cc: gregkh, linux, caleb.connolly, linux-arm-msm, linux-usb,
linux-kernel, angus.chen, stable, Rex Nie
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>
---
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
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v4] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
2024-10-30 13:36 ` [PATCH v4] " Rex Nie
@ 2024-10-31 10:56 ` Heikki Krogerus
2024-11-01 15:45 ` Bjorn Andersson
1 sibling, 0 replies; 16+ messages in thread
From: Heikki Krogerus @ 2024-10-31 10:56 UTC (permalink / raw)
To: Rex Nie
Cc: bryan.odonoghue, gregkh, linux, caleb.connolly, linux-arm-msm,
linux-usb, linux-kernel, angus.chen, stable
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v4] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
2024-10-30 13:36 ` [PATCH v4] " Rex Nie
2024-10-31 10:56 ` Heikki Krogerus
@ 2024-11-01 15:45 ` Bjorn Andersson
2024-11-02 12:27 ` 答复: " Rex Nie
1 sibling, 1 reply; 16+ messages in thread
From: Bjorn Andersson @ 2024-11-01 15:45 UTC (permalink / raw)
To: Rex Nie
Cc: bryan.odonoghue, heikki.krogerus, gregkh, linux, caleb.connolly,
linux-arm-msm, linux-usb, linux-kernel, angus.chen, stable
On Wed, Oct 30, 2024 at 09:36:32PM GMT, 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: Bjorn Andersson <andersson@kernel.org>
Nice job. Next time, please don't use In-Reply-To between patch
versions.
Regards,
Bjorn
> ---
> 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
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread* 答复: [PATCH v4] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier
2024-11-01 15:45 ` Bjorn Andersson
@ 2024-11-02 12:27 ` Rex Nie
0 siblings, 0 replies; 16+ messages in thread
From: Rex Nie @ 2024-11-02 12:27 UTC (permalink / raw)
To: Bjorn Andersson
Cc: bryan.odonoghue@linaro.org, heikki.krogerus@linux.intel.com,
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, stable@vger.kernel.org
Bjorn,
Ok, get it, Thanks.
BRs
Rex
> -----邮件原件-----
> 发件人: Bjorn Andersson <andersson@kernel.org>
> 发送时间: 2024年11月1日 23:45
> 收件人: Rex Nie <rex.nie@jaguarmicro.com>
> 抄送: bryan.odonoghue@linaro.org; heikki.krogerus@linux.intel.com;
> 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 <angus.chen@jaguarmicro.com>;
> stable@vger.kernel.org
> 主题: Re: [PATCH v4] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len
> earlier
>
> External Mail: This email originated from OUTSIDE of the organization!
> Do not click links, open attachments or provide ANY information unless you
> recognize the sender and know the content is safe.
>
>
> On Wed, Oct 30, 2024 at 09:36:32PM GMT, 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: Bjorn Andersson <andersson@kernel.org>
>
> Nice job. Next time, please don't use In-Reply-To between patch versions.
>
> Regards,
> Bjorn
>
> > ---
> > 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@linar
> > o.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
> >
> >
^ permalink raw reply [flat|nested] 16+ messages in thread