Re: [bug report] pinctrl: core: Handling pinmux and pinconf separately

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux