linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: michal.simek@xilinx.com
Cc: linux-gpio@vger.kernel.org
Subject: Re: [bug report] pinctrl: core: Handling pinmux and pinconf separately
Date: Fri, 12 Mar 2021 09:56:37 +0300	[thread overview]
Message-ID: <20210312065637.GM21246@kadam> (raw)
In-Reply-To: <YEsPXZ40nXAHnm4O@mwanda>

It also complains about the next loop but that's a false positive
because dealing with lists of data is tricky.

drivers/pinctrl/core.c:1297 pinctrl_commit_state() error: uninitialized symbol 'ret'.

I saw these two warnings initially from zero day bot but didn't forward
it on because I only noticed the issue with second loop and not the
first one.  #LifeLessonOrSomething

regards,
dan carpenter

On Fri, Mar 12, 2021 at 09:51:09AM +0300, Dan Carpenter wrote:
> Hello Michal Simek,
> 
> The patch 0952b7ec1614: "pinctrl: core: Handling pinmux and pinconf
> separately" from Mar 10, 2021, leads to the following static checker
> warning:
> 
> 	drivers/pinctrl/core.c:1275 pinctrl_commit_state()
> 	error: uninitialized symbol 'ret'.
> 
> drivers/pinctrl/core.c
>   1239  static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
>   1240  {
>   1241          struct pinctrl_setting *setting, *setting2;
>   1242          struct pinctrl_state *old_state = p->state;
>   1243          int ret;
>   1244  
>   1245          if (p->state) {
>   1246                  /*
>   1247                   * For each pinmux setting in the old state, forget SW's record
>   1248                   * of mux owner for that pingroup. Any pingroups which are
>   1249                   * still owned by the new state will be re-acquired by the call
>   1250                   * to pinmux_enable_setting() in the loop below.
>   1251                   */
>   1252                  list_for_each_entry(setting, &p->state->settings, node) {
>   1253                          if (setting->type != PIN_MAP_TYPE_MUX_GROUP)
>   1254                                  continue;
>   1255                          pinmux_disable_setting(setting);
>   1256                  }
>   1257          }
>   1258  
>   1259          p->state = NULL;
>   1260  
>   1261          /* Apply all the settings for the new state - pinmux first */
>   1262          list_for_each_entry(setting, &state->settings, node) {
>   1263                  switch (setting->type) {
>   1264                  case PIN_MAP_TYPE_MUX_GROUP:
>   1265                          ret = pinmux_enable_setting(setting);
>   1266                          break;
>   1267                  case PIN_MAP_TYPE_CONFIGS_PIN:
>   1268                  case PIN_MAP_TYPE_CONFIGS_GROUP:
>   1269                          break;
> 
> "ret" not set on these cases.
> 
>   1270                  default:
>   1271                          ret = -EINVAL;
>   1272                          break;
>   1273                  }
>   1274  
>   1275                  if (ret < 0)
>   1276                          goto unapply_new_state;
>   1277  
>   1278                  /* Do not link hogs (circular dependency) */
>   1279                  if (p != setting->pctldev->p)
> 
> regards,
> dan carpenter

  reply	other threads:[~2021-03-12  6:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  6:51 [bug report] pinctrl: core: Handling pinmux and pinconf separately Dan Carpenter
2021-03-12  6:56 ` Dan Carpenter [this message]
2021-03-12  7:33   ` Michal Simek

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=20210312065637.GM21246@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=michal.simek@xilinx.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;
as well as URLs for NNTP newsgroup(s).