From: Fedor Pchelkin <pchelkin@ispras.ru>
To: "Alexey V. Vissarionov" <gremlin@altlinux.org>,
Vasiliy Kovalev <kovalev@altlinux.org>
Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
lvc-project@linuxtesting.org,
Casey Connolly <casey.connolly@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH v1] usb: typec: tcpm: qcom: initialize currsrc explicitly
Date: Tue, 14 Jul 2026 16:47:24 +0300 [thread overview]
Message-ID: <alY7G3egPqw1iaPR@fedora> (raw)
In-Reply-To: <20260713182500.GB22956@altlinux.org>
On Mon, 13. Jul 21:25, Alexey V. Vissarionov wrote:
> When regmap_read() fails, the execution goes to done: label, where
> currsrc is passed to rp_sel_to_name() and used as an index after a
> proper check. However, to make this situation easier to notice, an
> explicit initialization of currsrc with obviously impossible value
> is suggested. Alas, we can't simply use zero value here because it
> means TYPEC_SRC_RP_SEL_80UA.
>
> Found by ALT Linux Team (altlinux.org) and Linux Verification Center
> (linuxtesting.org) using SVACE.
>
> Signed-off-by: Alexey V. Vissarionov <gremlin@altlinux.org>
> ---
> drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> index bf985efe1cd6bea4..d7cb69cf6044841b 100644
> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
> @@ -461,8 +461,8 @@ static int qcom_pmic_typec_port_set_cc(struct tcpc_dev *tcpc,
> struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
> struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
> struct device *dev = pmic_typec_port->dev;
> - unsigned int mode, currsrc;
> - unsigned int misc;
> + unsigned int currsrc = 0xFF; /* error, easy to notice in the log */
> + unsigned int mode, misc;
> unsigned long flags;
> int ret;
'mode' and 'misc' should be initialized as well. Though this all was
already covered with the patch [1], which got the review two weeks ago.
Note that it did initialize currsrc with zero value instead of 0xFF.
It's confusing a bit. Maybe [1] should be respinned now with
currsrc = 0xFF or whatever?
+Cc Vasiliy
[1]: https://lore.kernel.org/all/20260630120114.185169-1-kovalev@altlinux.org/
next prev parent reply other threads:[~2026-07-14 13:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <O53N7pugg1-s76jrwoKAhbBDXR8MpaQcpeBZ-yXGvX_N496X72YHCZC4tzar29CKo0MGFft9Ctcq-p5za2l7cg==@protonmail.internalid>
2026-07-13 18:25 ` [PATCH v1] usb: typec: tcpm: qcom: initialize currsrc explicitly Alexey V. Vissarionov
2026-07-14 8:26 ` Bryan O'Donoghue
2026-07-14 13:32 ` Heikki Krogerus
2026-07-14 13:47 ` Fedor Pchelkin [this message]
2026-07-14 16:47 ` Vasiliy Kovalev
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=alY7G3egPqw1iaPR@fedora \
--to=pchelkin@ispras.ru \
--cc=bryan.odonoghue@linaro.org \
--cc=casey.connolly@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=gremlin@altlinux.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=kovalev@altlinux.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lvc-project@linuxtesting.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