From: kernel test robot <lkp@intel.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
"Dmitry Osipenko" <digetx@gmail.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Vladimir Zapolskiy <vz@mleia.com>
Subject: Re: [PATCH 4/7] regulator: push allocation in set_consumer_device_supply() out of lock
Date: Tue, 11 Aug 2020 13:23:47 +0800 [thread overview]
Message-ID: <202008111330.UvK1uTd7%lkp@intel.com> (raw)
In-Reply-To: <2a978483b064b810b00e072fcdb6c3d24a896bd8.1597107682.git.mirq-linux@rere.qmqm.pl>
[-- Attachment #1: Type: text/plain, Size: 6858 bytes --]
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 <lkp@intel.com>
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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37205 bytes --]
next prev parent reply other threads:[~2020-08-11 5:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 1:07 [PATCH 0/7] regulator: fix deadlock vs memory reclaim Michał Mirosław
2020-08-11 1:07 ` [PATCH 1/7] regulator: push allocation in regulator_init_coupling() outside of lock Michał Mirosław
2020-08-11 15:59 ` Dmitry Osipenko
2020-08-11 16:27 ` Dmitry Osipenko
2020-08-11 17:20 ` Michał Mirosław
2020-08-11 21:02 ` Dmitry Osipenko
2020-08-11 1:07 ` [PATCH 3/7] regulator: push allocations in create_regulator() " Michał Mirosław
2020-08-11 1:07 ` [PATCH 2/7] regulator: push allocation in regulator_ena_gpio_request() out " Michał Mirosław
2020-08-11 1:07 ` [PATCH 4/7] regulator: push allocation in set_consumer_device_supply() " Michał Mirosław
2020-08-11 5:23 ` kernel test robot [this message]
2020-08-11 17:28 ` Michał Mirosław
2020-08-11 1:07 ` [PATCH 6/7] regulator: cleanup regulator_ena_gpio_free() Michał Mirosław
2020-08-11 1:07 ` [PATCH 5/7] regulator: plug of_node leak in regulator_register()'s error path Michał Mirosław
2020-08-11 6:15 ` Vladimir Zapolskiy
2020-08-11 1:07 ` [PATCH 7/7] regulator: remove superfluous lock in regulator_resolve_coupling() Michał Mirosław
2020-08-11 15:56 ` Dmitry Osipenko
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=202008111330.UvK1uTd7%lkp@intel.com \
--to=lkp@intel.com \
--cc=broonie@kernel.org \
--cc=digetx@gmail.com \
--cc=kbuild-all@lists.01.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mirq-linux@rere.qmqm.pl \
--cc=vz@mleia.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
all inboxes | Powered by JetHome®