From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rosen Penev <rosenp@gmail.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, "kernelci.org bot" <bot@kernelci.org>
Subject: Re: [PATCH] usb: typec: intel_pmc_mux: Zero initialize num_ports in pmc_usb_probe()
Date: Wed, 6 May 2026 12:39:57 +0300 [thread overview]
Message-ID: <afsMbeGfk5EHxFHV@kuha> (raw)
In-Reply-To: <20260506-typec-intel_pmc_mux-fix-uninit-num_ports-v1-1-929b128a32e9@kernel.org>
On Wed, May 06, 2026 at 02:05:54PM +0800, Nathan Chancellor wrote:
> Clang warns (or errors with CONFIG_WERROR=y / W=e):
>
> drivers/usb/typec/mux/intel_pmc_mux.c:740:3: error: variable 'num_ports' is uninitialized when used here [-Werror,-Wuninitialized]
> 740 | num_ports++;
> | ^~~~~~~~~
>
> This should have been initialized to zero. Do so now to clean up the
> warning and ensure num_ports does not use uninitialized memory.
>
> Fixes: 8bdb0b3830ea ("usb: typec: intel_pmc_mux: combine kzalloc + kcalloc")
> Reported-by: kernelci.org bot <bot@kernelci.org>
> Closes: https://lore.kernel.org/177793914437.2560.9287713196857718000@997d03828cfd/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/mux/intel_pmc_mux.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
> index e22b070a140f..219a32da1348 100644
> --- a/drivers/usb/typec/mux/intel_pmc_mux.c
> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c
> @@ -732,7 +732,7 @@ static int pmc_usb_probe(struct platform_device *pdev)
> {
> struct fwnode_handle *fwnode = NULL;
> struct pmc_usb *pmc;
> - u8 num_ports;
> + u8 num_ports = 0;
> int i = 0;
> int ret;
>
thanks,
--
heikki
prev parent reply other threads:[~2026-05-06 9:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 6:05 [PATCH] usb: typec: intel_pmc_mux: Zero initialize num_ports in pmc_usb_probe() Nathan Chancellor
2026-05-06 9:39 ` Heikki Krogerus [this message]
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=afsMbeGfk5EHxFHV@kuha \
--to=heikki.krogerus@linux.intel.com \
--cc=bot@kernelci.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=rosenp@gmail.com \
/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