mbox series

[0/2] MediaTek pinctrl cleanups and improvements

Message ID 20230118062036.26258-1-Guodong.Liu@mediatek.com (mailing list archive)
Headers show
Series MediaTek pinctrl cleanups and improvements | expand

Message

Guodong Liu Jan. 18, 2023, 6:20 a.m. UTC
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(-)

Comments

Linus Walleij Jan. 26, 2023, 1:40 p.m. UTC | #1
On Wed, Jan 18, 2023 at 7:20 AM Guodong Liu <Guodong.Liu@mediatek.com> wrote:

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

Patches applied!

Yours,
Linus Walleij