Hi "Michał, I love your patch! Perhaps something to improve: [auto build test WARNING on regulator/for-next] [also build test WARNING on v5.8 next-20200810] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Micha-Miros-aw/regulator-fix-deadlock-vs-memory-reclaim/20200811-091414 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next config: x86_64-randconfig-m001-20200810 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot New smatch warnings: drivers/regulator/core.c:1491 set_consumer_device_supply() warn: overwrite may leak 'node' Old smatch warnings: drivers/regulator/core.c:129 regulator_ops_is_valid() error: we previously assumed 'rdev->constraints' could be null (see line 128) drivers/regulator/core.c:3051 regulator_get_hardware_vsel_register() warn: inconsistent indenting vim +/node +1491 drivers/regulator/core.c 3801b86aa482d2 Mark Brown 2011-06-09 1448 a5766f11cfd3a0 Liam Girdwood 2008-10-10 1449 /** 06c63f9396133f Randy Dunlap 2010-11-18 1450 * set_consumer_device_supply - Bind a regulator to a symbolic supply 69279fb9a95051 Mark Brown 2008-12-31 1451 * @rdev: regulator source 40f9244f4da897 Mark Brown 2009-06-17 1452 * @consumer_dev_name: dev_name() string for device supply applies to a5766f11cfd3a0 Liam Girdwood 2008-10-10 1453 * @supply: symbolic name for supply a5766f11cfd3a0 Liam Girdwood 2008-10-10 1454 * a5766f11cfd3a0 Liam Girdwood 2008-10-10 1455 * Allows platform initialisation code to map physical regulator a5766f11cfd3a0 Liam Girdwood 2008-10-10 1456 * sources to symbolic names for supplies for use by devices. Devices a5766f11cfd3a0 Liam Girdwood 2008-10-10 1457 * should use these symbolic names to request regulators, avoiding the a5766f11cfd3a0 Liam Girdwood 2008-10-10 1458 * need to provide board-specific regulator names as platform data. a5766f11cfd3a0 Liam Girdwood 2008-10-10 1459 */ a5766f11cfd3a0 Liam Girdwood 2008-10-10 1460 static int set_consumer_device_supply(struct regulator_dev *rdev, 737f360d5bef5e Mark Brown 2012-02-02 1461 const char *consumer_dev_name, 40f9244f4da897 Mark Brown 2009-06-17 1462 const char *supply) a5766f11cfd3a0 Liam Girdwood 2008-10-10 1463 { a5766f11cfd3a0 Liam Girdwood 2008-10-10 1464 struct regulator_map *node; 9ed2099edca26d Mark Brown 2009-07-21 1465 int has_dev; a5766f11cfd3a0 Liam Girdwood 2008-10-10 1466 a5766f11cfd3a0 Liam Girdwood 2008-10-10 1467 if (supply == NULL) a5766f11cfd3a0 Liam Girdwood 2008-10-10 1468 return -EINVAL; a5766f11cfd3a0 Liam Girdwood 2008-10-10 1469 9ed2099edca26d Mark Brown 2009-07-21 1470 if (consumer_dev_name != NULL) 9ed2099edca26d Mark Brown 2009-07-21 1471 has_dev = 1; 9ed2099edca26d Mark Brown 2009-07-21 1472 else 9ed2099edca26d Mark Brown 2009-07-21 1473 has_dev = 0; 9ed2099edca26d Mark Brown 2009-07-21 1474 bcadf558ba875d Michał Mirosław 2020-08-11 1475 node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL); bcadf558ba875d Michał Mirosław 2020-08-11 1476 if (node == NULL) bcadf558ba875d Michał Mirosław 2020-08-11 1477 return -ENOMEM; bcadf558ba875d Michał Mirosław 2020-08-11 1478 bcadf558ba875d Michał Mirosław 2020-08-11 1479 node->regulator = rdev; bcadf558ba875d Michał Mirosław 2020-08-11 1480 node->supply = supply; bcadf558ba875d Michał Mirosław 2020-08-11 1481 bcadf558ba875d Michał Mirosław 2020-08-11 1482 if (has_dev) { bcadf558ba875d Michał Mirosław 2020-08-11 1483 node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); bcadf558ba875d Michał Mirosław 2020-08-11 1484 if (node->dev_name == NULL) { bcadf558ba875d Michał Mirosław 2020-08-11 1485 kfree(node); bcadf558ba875d Michał Mirosław 2020-08-11 1486 return -ENOMEM; bcadf558ba875d Michał Mirosław 2020-08-11 1487 } bcadf558ba875d Michał Mirosław 2020-08-11 1488 } bcadf558ba875d Michał Mirosław 2020-08-11 1489 bcadf558ba875d Michał Mirosław 2020-08-11 1490 mutex_lock(®ulator_list_mutex); 6001e13c5f708e David Brownell 2008-12-31 @1491 list_for_each_entry(node, ®ulator_map_list, list) { 23b5cc2ab67832 Jani Nikula 2010-04-29 1492 if (node->dev_name && consumer_dev_name) { 23b5cc2ab67832 Jani Nikula 2010-04-29 1493 if (strcmp(node->dev_name, consumer_dev_name) != 0) 6001e13c5f708e David Brownell 2008-12-31 1494 continue; 23b5cc2ab67832 Jani Nikula 2010-04-29 1495 } else if (node->dev_name || consumer_dev_name) { 23b5cc2ab67832 Jani Nikula 2010-04-29 1496 continue; 23b5cc2ab67832 Jani Nikula 2010-04-29 1497 } 23b5cc2ab67832 Jani Nikula 2010-04-29 1498 6001e13c5f708e David Brownell 2008-12-31 1499 if (strcmp(node->supply, supply) != 0) 6001e13c5f708e David Brownell 2008-12-31 1500 continue; 6001e13c5f708e David Brownell 2008-12-31 1501 737f360d5bef5e Mark Brown 2012-02-02 1502 pr_debug("%s: %s/%s is '%s' supply; fail %s/%s\n", 737f360d5bef5e Mark Brown 2012-02-02 1503 consumer_dev_name, 6001e13c5f708e David Brownell 2008-12-31 1504 dev_name(&node->regulator->dev), 6001e13c5f708e David Brownell 2008-12-31 1505 node->regulator->desc->name, 6001e13c5f708e David Brownell 2008-12-31 1506 supply, 1083c39346d482 Mark Brown 2009-10-22 1507 dev_name(&rdev->dev), rdev_get_name(rdev)); bcadf558ba875d Michał Mirosław 2020-08-11 1508 goto fail; 6001e13c5f708e David Brownell 2008-12-31 1509 } 6001e13c5f708e David Brownell 2008-12-31 1510 bcadf558ba875d Michał Mirosław 2020-08-11 1511 list_add(&node->list, ®ulator_map_list); bcadf558ba875d Michał Mirosław 2020-08-11 1512 mutex_unlock(®ulator_list_mutex); a5766f11cfd3a0 Liam Girdwood 2008-10-10 1513 bcadf558ba875d Michał Mirosław 2020-08-11 1514 return 0; a5766f11cfd3a0 Liam Girdwood 2008-10-10 1515 bcadf558ba875d Michał Mirosław 2020-08-11 1516 fail: bcadf558ba875d Michał Mirosław 2020-08-11 1517 mutex_unlock(®ulator_list_mutex); bcadf558ba875d Michał Mirosław 2020-08-11 1518 kfree(node->dev_name); 40f9244f4da897 Mark Brown 2009-06-17 1519 kfree(node); bcadf558ba875d Michał Mirosław 2020-08-11 1520 return -EBUSY; a5766f11cfd3a0 Liam Girdwood 2008-10-10 1521 } a5766f11cfd3a0 Liam Girdwood 2008-10-10 1522 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org