summaryrefslogtreecommitdiff
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
authorYue Hu <huyue2@yulong.com>2019-01-23 11:56:48 +0300
committerKees Cook <keescook@chromium.org>2019-02-12 23:10:43 +0300
commit1e0f67a96aedd0b5fbd3ae743e68a26606ea98e8 (patch)
tree374370fe3ded31a8b5bd66f03a0970bb0aa09c9c /fs/pstore/ram.c
parent4c6c4d34536744f2c9e171ef5bb548a06a525501 (diff)
downloadlinux-1e0f67a96aedd0b5fbd3ae743e68a26606ea98e8.tar.xz
pstore/ram: Move initialization earlier
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 <huyue2@yulong.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index b2471d430048..d06e2f3e3bec 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -717,15 +717,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.
@@ -735,6 +726,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");