diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2016-03-02 06:24:49 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2016-03-03 17:51:31 -0500 |
commit | 815d74b35e3366261ac2519af64b53f76fb0c0e1 (patch) | |
tree | 98a5deda136af7f60734a469d4775fe3377d4542 | |
parent | e53b50c0cbe392c946807abf7d07615a3c588642 (diff) |
of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays()
of_overlay_destroy() can return `-ENODEV' error code once it
failed to find the requested overlay in `ov_idr'. However,
of_unittest_destroy_tracked_overlays() does not handle this
error code correctly and continues to call of_overlay_destroy()
on the 'missing' overlay over and over again. This results in
a printk flood
[..]
[ 33.497583] of_overlay_destroy: Could not find overlay #6
[ 33.497583] of_overlay_destroy: Could not find overlay #6
[ 33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[ 33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[ 33.497586] of_overlay_destroy: Could not find overlay #6
[ 33.497586] of_overlay_destroy: Could not find overlay #6
[ 33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[ 33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[..]
which is not really good due to printk design, and can lead to soft
lockups, hard lockups, etc. (depending on the context console_unlock()
is being called from). The problem has bee observed in real life
and reported by Ying Huang.
This patch does not address the root cause of missing overlay in
`ov_idr', it fixes the endless loop only.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reported-by: kernel test robot <ying.huang@linux.intel.com>
Link: lkml.kernel.org/r/87fuwk1c0o.fsf@yhuang-dev.intel.com
Signed-off-by: Rob Herring <robh@kernel.org>
-rw-r--r-- | drivers/of/unittest.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 979b6e415cea..e986e6ee52e0 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c | |||
@@ -1165,6 +1165,11 @@ static void of_unittest_destroy_tracked_overlays(void) | |||
1165 | continue; | 1165 | continue; |
1166 | 1166 | ||
1167 | ret = of_overlay_destroy(id + overlay_first_id); | 1167 | ret = of_overlay_destroy(id + overlay_first_id); |
1168 | if (ret == -ENODEV) { | ||
1169 | pr_warn("%s: no overlay to destroy for #%d\n", | ||
1170 | __func__, id + overlay_first_id); | ||
1171 | continue; | ||
1172 | } | ||
1168 | if (ret != 0) { | 1173 | if (ret != 0) { |
1169 | defers++; | 1174 | defers++; |
1170 | pr_warn("%s: overlay destroy failed for #%d\n", | 1175 | pr_warn("%s: overlay destroy failed for #%d\n", |