From: Yue Hu
stable inclusion
from stable-5.10
category: feature
commit:1e0f67a96aedd0b5fbd3ae743e68a26606ea98e8
issue: #I4919J
--------------------------------
Since only one single ramoops area allowed at a time, other probes
(like device tree) are meaningless, as it will waste CPU resources.
So let's check for being already initialized first.
Signed-off-by: Yue Hu
Signed-off-by: Kees Cook
(cherry picked from commit 1e0f67a96aedd0b5fbd3ae743e68a26606ea98e8)
Signed-off-by: roger
---
fs/pstore/ram.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 3f7df241e1f9..2921905cb7e5 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -728,15 +728,6 @@ static int ramoops_probe(struct platform_device *pdev)
phys_addr_t paddr;
int err = -EINVAL;
- if (dev_of_node(dev) && !pdata) {
- pdata = &pdata_local;
- memset(pdata, 0, sizeof(*pdata));
-
- err = ramoops_parse_dt(pdev, pdata);
- if (err < 0)
- goto fail_out;
- }
-
/*
* Only a single ramoops area allowed at a time, so fail extra
* probes.
@@ -746,6 +737,15 @@ static int ramoops_probe(struct platform_device *pdev)
goto fail_out;
}
+ if (dev_of_node(dev) && !pdata) {
+ pdata = &pdata_local;
+ memset(pdata, 0, sizeof(*pdata));
+
+ err = ramoops_parse_dt(pdev, pdata);
+ if (err < 0)
+ goto fail_out;
+ }
+
/* Make sure we didn't get bogus platform data pointer. */
if (!pdata) {
pr_err("NULL platform data\n");
--
2.17.1