[xlnx:release-2020.2.2_k26 207/241] drivers/pinctrl/core.c:1273:6: warning: 'ret' may be used uninitialized in this function

kernel test robot lkp at intel.com
Mon Apr 19 21:35:35 BST 2021


tree:   https://github.com/Xilinx/linux-xlnx release-2020.2.2_k26
head:   4731ff5042ce76fc145bc2797faa2d91b090675e
commit: 11367d8e6e31164b198401335b9a19b5b7234ec0 [207/241] pinctrl: core: Handling pinmux and pinconf separately
config: um-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/Xilinx/linux-xlnx/commit/11367d8e6e31164b198401335b9a19b5b7234ec0
        git remote add xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xlnx release-2020.2.2_k26
        git checkout 11367d8e6e31164b198401335b9a19b5b7234ec0
        # save the attached .config to linux build tree
        make W=1 W=1 ARCH=um 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
   drivers/pinctrl/core.c: In function 'pinctrl_commit_state':
>> drivers/pinctrl/core.c:1273:6: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
    1273 |   if (ret < 0)
         |      ^

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for UIO_DMEM_GENIRQ
   Depends on UIO && HAS_DMA
   Selected by
   - UIO_XILINX_AI_ENGINE && UIO


vim +/ret +1273 drivers/pinctrl/core.c

  1231	
  1232	/**
  1233	 * pinctrl_commit_state() - select/activate/program a pinctrl state to HW
  1234	 * @p: the pinctrl handle for the device that requests configuration
  1235	 * @state: the state handle to select/activate/program
  1236	 */
  1237	static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
  1238	{
  1239		struct pinctrl_setting *setting, *setting2;
  1240		struct pinctrl_state *old_state = p->state;
  1241		int ret;
  1242	
  1243		if (p->state) {
  1244			/*
  1245			 * For each pinmux setting in the old state, forget SW's record
  1246			 * of mux owner for that pingroup. Any pingroups which are
  1247			 * still owned by the new state will be re-acquired by the call
  1248			 * to pinmux_enable_setting() in the loop below.
  1249			 */
  1250			list_for_each_entry(setting, &p->state->settings, node) {
  1251				if (setting->type != PIN_MAP_TYPE_MUX_GROUP)
  1252					continue;
  1253				pinmux_disable_setting(setting);
  1254			}
  1255		}
  1256	
  1257		p->state = NULL;
  1258	
  1259		/* Apply all the settings for the new state - pinmux first */
  1260		list_for_each_entry(setting, &state->settings, node) {
  1261			switch (setting->type) {
  1262			case PIN_MAP_TYPE_MUX_GROUP:
  1263				ret = pinmux_enable_setting(setting);
  1264				break;
  1265			case PIN_MAP_TYPE_CONFIGS_PIN:
  1266			case PIN_MAP_TYPE_CONFIGS_GROUP:
  1267				break;
  1268			default:
  1269				ret = -EINVAL;
  1270				break;
  1271			}
  1272	
> 1273			if (ret < 0)
  1274				goto unapply_new_state;
  1275	
  1276			/* Do not link hogs (circular dependency) */
  1277			if (p != setting->pctldev->p)
  1278				pinctrl_link_add(setting->pctldev, p->dev);
  1279		}
  1280	
  1281		/* Apply all the settings for the new state - pinconf after */
  1282		list_for_each_entry(setting, &state->settings, node) {
  1283			switch (setting->type) {
  1284			case PIN_MAP_TYPE_MUX_GROUP:
  1285				break;
  1286			case PIN_MAP_TYPE_CONFIGS_PIN:
  1287			case PIN_MAP_TYPE_CONFIGS_GROUP:
  1288				ret = pinconf_apply_setting(setting);
  1289				break;
  1290			default:
  1291				ret = -EINVAL;
  1292				break;
  1293			}
  1294	
  1295			if (ret < 0) {
  1296				goto unapply_new_state;
  1297			}
  1298	
  1299			/* Do not link hogs (circular dependency) */
  1300			if (p != setting->pctldev->p)
  1301				pinctrl_link_add(setting->pctldev, p->dev);
  1302		}
  1303	
  1304		p->state = state;
  1305	
  1306		return 0;
  1307	
  1308	unapply_new_state:
  1309		dev_err(p->dev, "Error applying setting, reverse things back\n");
  1310	
  1311		list_for_each_entry(setting2, &state->settings, node) {
  1312			if (&setting2->node == &setting->node)
  1313				break;
  1314			/*
  1315			 * All we can do here is pinmux_disable_setting.
  1316			 * That means that some pins are muxed differently now
  1317			 * than they were before applying the setting (We can't
  1318			 * "unmux a pin"!), but it's not a big deal since the pins
  1319			 * are free to be muxed by another apply_setting.
  1320			 */
  1321			if (setting2->type == PIN_MAP_TYPE_MUX_GROUP)
  1322				pinmux_disable_setting(setting2);
  1323		}
  1324	
  1325		/* There's no infinite recursive loop here because p->state is NULL */
  1326		if (old_state)
  1327			pinctrl_select_state(p, old_state);
  1328	
  1329		return ret;
  1330	}
  1331	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 21821 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210420/8916ef5d/attachment-0001.gz>


More information about the linux-arm-kernel mailing list