Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guodong Liu <Guodong.Liu@mediatek.com>
To: Sean Wang <sean.wang@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Light Hsieh <light.hsieh@mediatek.com>,
	Rob Herring <robh@kernel.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: <linux-mediatek@lists.infradead.org>,
	<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Zhiyong Tao <zhiyong.tao@mediatek.com>,
	Guodong Liu <Guodong.Liu@mediatek.com>
Subject: [PATCH 0/2] MediaTek pinctrl cleanups and improvements
Date: Wed, 18 Jan 2023 14:20:34 +0800	[thread overview]
Message-ID: <20230118062036.26258-1-Guodong.Liu@mediatek.com> (raw)

Patch 1. Fix coverity by initializing pullen and pullup as zero.
Coverity error message:
	This issue is detected by 
		Checker: UNINIT
		Type: Uninitialized scalar variable
	Defect is in:
		File: drivers/pinctrl/mediatek/pinctrl-paris.c
		Function and lines: 
				mtk_pctrl_show_one_pin:627
	CID 10350517 (#1 of 2): Uninitialized scalar variable (UNINIT)
	(7) uninit_use: Using uninitialized value pullen.
	                rsel = pullen;
	                pullen = 1;
	        } else {
	CID 10350553 (#1 of 1): Uninitialized scalar variable (UNINIT)
	(8) uninit_use_in_call: Using uninitialized value pullup when
	    calling scnprintf.
        len += scnprintf(buf + len, buf_len - len,
                        "%03d: %1d%1d%1d%1d%02d%1d%1d%1d%1d",
                        gpio,
                        pinmux,
                        mtk_pctrl_get_direction(hw, gpio),
                        mtk_pctrl_get_out(hw, gpio),
                        mtk_pctrl_get_in(hw, gpio),
                        mtk_pctrl_get_driving(hw, gpio),
                        mtk_pctrl_get_smt(hw, gpio),
                        mtk_pctrl_get_ies(hw, gpio),
                        pullen,
                        pullup);

Patch 2. Fix coverity by initializing *buf as zero.
Coverity error message:
	This issue is detected by 
		Checker: UNINIT
		Type: Uninitialized scalar variable
	Defect is in:
		File: drivers/pinctrl/mediatek/pinctrl-paris.c
		Function and lines: 
				mtk_pctrl_dbg_show
	static void mtk_pctrl_dbg_show(struct pinctrl_dev *pctldev,
				       struct seq_file *s,
				       unsigned int gpio)
	{
	        struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev);
        	(1) var_decl: Declaring variable buf without initializer.
	        char buf[PIN_DBG_BUF_SZ];

        	(void)mtk_pctrl_show_one_pin(hw, gpio, buf, PIN_DBG_BUF_SZ);

	CID 10801732 (#1 of 1): Uninitialized scalar variable (UNINIT)
	(2) uninit_use_in_call: Using uninitialized value *buf as argument to %s
	    when calling seq_printf.
	seq_printf(s, "%s", buf);

Guodong Liu (2):
  pinctrl: mediatek: Initialize variable pullen and pullup to zero
  pinctrl: mediatek: Initialize variable *buf to zero

 drivers/pinctrl/mediatek/pinctrl-paris.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.25.1



             reply	other threads:[~2023-01-18  6:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  6:20 Guodong Liu [this message]
2023-01-18  6:20 ` [PATCH 1/2] pinctrl: mediatek: Initialize variable pullen and pullup to zero Guodong Liu
2023-01-18 11:26   ` AngeloGioacchino Del Regno
2023-01-18  6:20 ` [PATCH 2/2] pinctrl: mediatek: Initialize variable *buf " Guodong Liu
2023-01-18 11:26   ` AngeloGioacchino Del Regno
2023-01-26 13:40 ` [PATCH 0/2] MediaTek pinctrl cleanups and improvements Linus Walleij

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=20230118062036.26258-1-Guodong.Liu@mediatek.com \
    --to=guodong.liu@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=light.hsieh@mediatek.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@kernel.org \
    --cc=sean.wang@kernel.org \
    --cc=zhiyong.tao@mediatek.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