linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Bartosz Golaszewski <brgl@bgdev.pl>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Alexey Klimov <alexey.klimov@linaro.org>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Sean Wang <sean.wang@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Paul Cercueil <paul@crapouillou.net>, Kees Cook <kees@kernel.org>,
	Andy Shevchenko <andy@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Dong Aisheng <aisheng.dong@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	Shawn Guo <shawnguo@kernel.org>, Jacky Bai <ping.bai@nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	NXP S32 Linux Team <s32@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Tony Lindgren <tony@atomide.com>,
	Haojian Zhuang <haojian.zhuang@linaro.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH v4 12/15] pinctrl: allow to mark pin functions as requestable GPIOs
Date: Wed, 13 Aug 2025 17:17:12 +0300	[thread overview]
Message-ID: <202508132044.XYcvSpm4-lkp@intel.com> (raw)
In-Reply-To: <20250812-pinctrl-gpio-pinfuncs-v4-12-bb3906c55e64@linaro.org>

Hi Bartosz,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/devres-provide-devm_kmemdup_const/20250812-170336
base:   8f5ae30d69d7543eee0d70083daf4de8fe15d585
patch link:    https://lore.kernel.org/r/20250812-pinctrl-gpio-pinfuncs-v4-12-bb3906c55e64%40linaro.org
patch subject: [PATCH v4 12/15] pinctrl: allow to mark pin functions as requestable GPIOs
config: um-randconfig-r072-20250813 (https://download.01.org/0day-ci/archive/20250813/202508132044.XYcvSpm4-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202508132044.XYcvSpm4-lkp@intel.com/

smatch warnings:
drivers/pinctrl/pinmux.c:96 pinmux_can_be_used_for_gpio() warn: variable dereferenced before check 'desc' (see line 92)

vim +/desc +96 drivers/pinctrl/pinmux.c

7cc4e6b0e4ddf6 Andy Shevchenko     2023-11-29   88  bool pinmux_can_be_used_for_gpio(struct pinctrl_dev *pctldev, unsigned int pin)
472a61e777fe78 Stefan Wahren       2019-08-14   89  {
472a61e777fe78 Stefan Wahren       2019-08-14   90  	struct pin_desc *desc = pin_desc_get(pctldev, pin);
472a61e777fe78 Stefan Wahren       2019-08-14   91  	const struct pinmux_ops *ops = pctldev->desc->pmxops;
6dd5ffb25d7e35 Bartosz Golaszewski 2025-08-12  @92  	const struct pinctrl_setting_mux *mux_setting = desc->mux_setting;
                                                                                                        ^^^^^^^^^^^^^^^^^
Patch adds a new dereference.

6dd5ffb25d7e35 Bartosz Golaszewski 2025-08-12   93  	bool func_is_gpio = false;
472a61e777fe78 Stefan Wahren       2019-08-14   94  
472a61e777fe78 Stefan Wahren       2019-08-14   95  	/* Can't inspect pin, assume it can be used */
6ba2fd391ac58c Alexandre Torgue    2019-12-04  @96  	if (!desc || !ops)
                                                            ^^^^^
The old code assumed desc could be NULL.

472a61e777fe78 Stefan Wahren       2019-08-14   97  		return true;
472a61e777fe78 Stefan Wahren       2019-08-14   98  
5a3e85c3c397c7 Mukesh Ojha         2024-10-15   99  	guard(mutex)(&desc->mux_lock);
6dd5ffb25d7e35 Bartosz Golaszewski 2025-08-12  100  	if (mux_setting && ops->function_is_gpio)
6dd5ffb25d7e35 Bartosz Golaszewski 2025-08-12  101  		func_is_gpio = ops->function_is_gpio(pctldev, mux_setting->func);
6dd5ffb25d7e35 Bartosz Golaszewski 2025-08-12  102  
6dd5ffb25d7e35 Bartosz Golaszewski 2025-08-12  103  	if (ops->strict && desc->mux_usecount && !func_is_gpio)
472a61e777fe78 Stefan Wahren       2019-08-14  104  		return false;
472a61e777fe78 Stefan Wahren       2019-08-14  105  
472a61e777fe78 Stefan Wahren       2019-08-14  106  	return !(ops->strict && !!desc->gpio_owner);
472a61e777fe78 Stefan Wahren       2019-08-14  107  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



  reply	other threads:[~2025-08-13 14:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12  8:26 [PATCH v4 00/15] pinctrl: introduce the concept of a GPIO pin function category Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 01/15] devres: provide devm_kmemdup_const() Bartosz Golaszewski
2025-08-12  9:16   ` Andy Shevchenko
2025-08-12  8:27 ` [PATCH v4 02/15] pinctrl: ingenic: use struct pinfunction instead of struct function_desc Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 03/15] pinctrl: airoha: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-08-13 16:57   ` Andy Shevchenko
2025-08-14  7:37     ` Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 04/15] pinctrl: mediatek: mt7988: use PINCTRL_PIN_FUNCTION() Bartosz Golaszewski
2025-08-14  3:57   ` Chen-Yu Tsai
2025-08-12  8:27 ` [PATCH v4 05/15] pinctrl: mediatek: moore: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-08-14  3:55   ` Chen-Yu Tsai
2025-08-12  8:27 ` [PATCH v4 06/15] pinctrl: imx: don't access the pin function radix tree directly Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 07/15] pinctrl: keembay: release allocated memory in detach path Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 08/15] pinctrl: keembay: use a dedicated structure for the pinfunction description Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 09/15] pinctrl: constify pinmux_generic_get_function() Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 10/15] pinctrl: make struct pinfunction a pointer in struct function_desc Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 11/15] pinctrl: qcom: use generic pin function helpers Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 12/15] pinctrl: allow to mark pin functions as requestable GPIOs Bartosz Golaszewski
2025-08-13 14:17   ` Dan Carpenter [this message]
2025-08-14  7:38     ` Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 13/15] pinctrl: qcom: add infrastructure for marking pin functions as GPIOs Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 14/15] pinctrl: qcom: mark the `gpio` and `egpio` pins function as non-strict functions Bartosz Golaszewski
2025-08-12  8:27 ` [PATCH v4 15/15] pinctrl: qcom: make the pinmuxing strict Bartosz Golaszewski

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=202508132044.XYcvSpm4-lkp@intel.com \
    --to=dan.carpenter@linaro.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=aisheng.dong@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexey.klimov@linaro.org \
    --cc=andersson@kernel.org \
    --cc=andy@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=brgl@bgdev.pl \
    --cc=david@redhat.com \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=haojian.zhuang@linaro.org \
    --cc=kees@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=konradybcio@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mhocko@suse.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=paul@crapouillou.net \
    --cc=ping.bai@nxp.com \
    --cc=rppt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s32@nxp.com \
    --cc=sean.wang@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=surenb@google.com \
    --cc=tony@atomide.com \
    --cc=vbabka@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).