* [thierryreding:for-5.5/dp 79/124] drivers/memory/core.c:79 of_memory_controller_get() error: double unlock 'mutex:&controllers_lock'
@ 2019-10-21 7:54 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2019-10-21 7:54 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4157 bytes --]
tree: https://github.com/thierryreding/linux for-5.5/dp
head: c80326581f9bf16162c2f3d5dcc5f006bbc93f86
commit: 429583789bbda8c3ef59f9b6c33fb483145752a4 [79/124] memory: Introduce memory controller mini-framework
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/memory/core.c:79 of_memory_controller_get() error: double unlock 'mutex:&controllers_lock'
Old smatch warnings:
include/linux/compiler.h:226 __write_once_size() warn: potential memory corrupting cast 8 vs 4 bytes
# https://github.com/thierryreding/linux/commit/429583789bbda8c3ef59f9b6c33fb483145752a4
git remote add thierryreding https://github.com/thierryreding/linux
git remote update thierryreding
git checkout 429583789bbda8c3ef59f9b6c33fb483145752a4
vim +79 drivers/memory/core.c
429583789bbda8 Thierry Reding 2019-08-20 41 static struct memory_controller *
429583789bbda8 Thierry Reding 2019-08-20 42 of_memory_controller_get(struct device *dev, struct device_node *np,
429583789bbda8 Thierry Reding 2019-08-20 43 const char *con_id)
429583789bbda8 Thierry Reding 2019-08-20 44 {
429583789bbda8 Thierry Reding 2019-08-20 45 const char *cells = "#memory-controller-cells";
429583789bbda8 Thierry Reding 2019-08-20 46 const char *names = "memory-controller-names";
429583789bbda8 Thierry Reding 2019-08-20 47 const char *prop = "memory-controllers";
429583789bbda8 Thierry Reding 2019-08-20 48 struct memory_controller *mc;
429583789bbda8 Thierry Reding 2019-08-20 49 struct of_phandle_args args;
429583789bbda8 Thierry Reding 2019-08-20 50 int index = 0, err;
429583789bbda8 Thierry Reding 2019-08-20 51
429583789bbda8 Thierry Reding 2019-08-20 52 if (con_id) {
429583789bbda8 Thierry Reding 2019-08-20 53 index = of_property_match_string(np, names, con_id);
429583789bbda8 Thierry Reding 2019-08-20 54 if (index < 0)
429583789bbda8 Thierry Reding 2019-08-20 55 return ERR_PTR(index);
429583789bbda8 Thierry Reding 2019-08-20 56 }
429583789bbda8 Thierry Reding 2019-08-20 57
429583789bbda8 Thierry Reding 2019-08-20 58 err = of_parse_phandle_with_args(np, prop, cells, index, &args);
429583789bbda8 Thierry Reding 2019-08-20 59 if (err) {
429583789bbda8 Thierry Reding 2019-08-20 60 if (err == -ENOENT)
429583789bbda8 Thierry Reding 2019-08-20 61 err = -ENODEV;
429583789bbda8 Thierry Reding 2019-08-20 62
429583789bbda8 Thierry Reding 2019-08-20 63 return ERR_PTR(err);
429583789bbda8 Thierry Reding 2019-08-20 64 }
429583789bbda8 Thierry Reding 2019-08-20 65
429583789bbda8 Thierry Reding 2019-08-20 66 mutex_lock(&controllers_lock);
429583789bbda8 Thierry Reding 2019-08-20 67
429583789bbda8 Thierry Reding 2019-08-20 68 list_for_each_entry(mc, &controllers, list) {
429583789bbda8 Thierry Reding 2019-08-20 69 if (mc->dev && mc->dev->of_node == args.np) {
429583789bbda8 Thierry Reding 2019-08-20 70 kref_get(&mc->ref);
429583789bbda8 Thierry Reding 2019-08-20 71 mutex_unlock(&controllers_lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
429583789bbda8 Thierry Reding 2019-08-20 72 goto unlock;
429583789bbda8 Thierry Reding 2019-08-20 73 }
429583789bbda8 Thierry Reding 2019-08-20 74 }
429583789bbda8 Thierry Reding 2019-08-20 75
429583789bbda8 Thierry Reding 2019-08-20 76 mc = ERR_PTR(-EPROBE_DEFER);
429583789bbda8 Thierry Reding 2019-08-20 77
429583789bbda8 Thierry Reding 2019-08-20 78 unlock:
429583789bbda8 Thierry Reding 2019-08-20 @79 mutex_unlock(&controllers_lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
429583789bbda8 Thierry Reding 2019-08-20 80 of_node_put(args.np);
429583789bbda8 Thierry Reding 2019-08-20 81 return mc;
429583789bbda8 Thierry Reding 2019-08-20 82 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 2+ messages in thread
* [thierryreding:for-5.5/dp 79/124] drivers/memory/core.c:79 of_memory_controller_get() error: double unlock 'mutex:&controllers_lock'
@ 2019-10-21 7:54 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2019-10-21 7:54 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4157 bytes --]
tree: https://github.com/thierryreding/linux for-5.5/dp
head: c80326581f9bf16162c2f3d5dcc5f006bbc93f86
commit: 429583789bbda8c3ef59f9b6c33fb483145752a4 [79/124] memory: Introduce memory controller mini-framework
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/memory/core.c:79 of_memory_controller_get() error: double unlock 'mutex:&controllers_lock'
Old smatch warnings:
include/linux/compiler.h:226 __write_once_size() warn: potential memory corrupting cast 8 vs 4 bytes
# https://github.com/thierryreding/linux/commit/429583789bbda8c3ef59f9b6c33fb483145752a4
git remote add thierryreding https://github.com/thierryreding/linux
git remote update thierryreding
git checkout 429583789bbda8c3ef59f9b6c33fb483145752a4
vim +79 drivers/memory/core.c
429583789bbda8 Thierry Reding 2019-08-20 41 static struct memory_controller *
429583789bbda8 Thierry Reding 2019-08-20 42 of_memory_controller_get(struct device *dev, struct device_node *np,
429583789bbda8 Thierry Reding 2019-08-20 43 const char *con_id)
429583789bbda8 Thierry Reding 2019-08-20 44 {
429583789bbda8 Thierry Reding 2019-08-20 45 const char *cells = "#memory-controller-cells";
429583789bbda8 Thierry Reding 2019-08-20 46 const char *names = "memory-controller-names";
429583789bbda8 Thierry Reding 2019-08-20 47 const char *prop = "memory-controllers";
429583789bbda8 Thierry Reding 2019-08-20 48 struct memory_controller *mc;
429583789bbda8 Thierry Reding 2019-08-20 49 struct of_phandle_args args;
429583789bbda8 Thierry Reding 2019-08-20 50 int index = 0, err;
429583789bbda8 Thierry Reding 2019-08-20 51
429583789bbda8 Thierry Reding 2019-08-20 52 if (con_id) {
429583789bbda8 Thierry Reding 2019-08-20 53 index = of_property_match_string(np, names, con_id);
429583789bbda8 Thierry Reding 2019-08-20 54 if (index < 0)
429583789bbda8 Thierry Reding 2019-08-20 55 return ERR_PTR(index);
429583789bbda8 Thierry Reding 2019-08-20 56 }
429583789bbda8 Thierry Reding 2019-08-20 57
429583789bbda8 Thierry Reding 2019-08-20 58 err = of_parse_phandle_with_args(np, prop, cells, index, &args);
429583789bbda8 Thierry Reding 2019-08-20 59 if (err) {
429583789bbda8 Thierry Reding 2019-08-20 60 if (err == -ENOENT)
429583789bbda8 Thierry Reding 2019-08-20 61 err = -ENODEV;
429583789bbda8 Thierry Reding 2019-08-20 62
429583789bbda8 Thierry Reding 2019-08-20 63 return ERR_PTR(err);
429583789bbda8 Thierry Reding 2019-08-20 64 }
429583789bbda8 Thierry Reding 2019-08-20 65
429583789bbda8 Thierry Reding 2019-08-20 66 mutex_lock(&controllers_lock);
429583789bbda8 Thierry Reding 2019-08-20 67
429583789bbda8 Thierry Reding 2019-08-20 68 list_for_each_entry(mc, &controllers, list) {
429583789bbda8 Thierry Reding 2019-08-20 69 if (mc->dev && mc->dev->of_node == args.np) {
429583789bbda8 Thierry Reding 2019-08-20 70 kref_get(&mc->ref);
429583789bbda8 Thierry Reding 2019-08-20 71 mutex_unlock(&controllers_lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
429583789bbda8 Thierry Reding 2019-08-20 72 goto unlock;
429583789bbda8 Thierry Reding 2019-08-20 73 }
429583789bbda8 Thierry Reding 2019-08-20 74 }
429583789bbda8 Thierry Reding 2019-08-20 75
429583789bbda8 Thierry Reding 2019-08-20 76 mc = ERR_PTR(-EPROBE_DEFER);
429583789bbda8 Thierry Reding 2019-08-20 77
429583789bbda8 Thierry Reding 2019-08-20 78 unlock:
429583789bbda8 Thierry Reding 2019-08-20 @79 mutex_unlock(&controllers_lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
429583789bbda8 Thierry Reding 2019-08-20 80 of_node_put(args.np);
429583789bbda8 Thierry Reding 2019-08-20 81 return mc;
429583789bbda8 Thierry Reding 2019-08-20 82 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-21 7:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-21 7:54 [thierryreding:for-5.5/dp 79/124] drivers/memory/core.c:79 of_memory_controller_get() error: double unlock 'mutex:&controllers_lock' Dan Carpenter
2019-10-21 7:54 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.