Skip to contentSkip to conversation

pstore/ram: Make initialization check as first one

PATCH Kees Cook 1 participant 1 message Feb 12, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Kees Cook

author Applied
#1 lore raw
Quoted 52 lines · Yue Hu

From 4320c0fcb5d685c8099937abce88e0b7fbbfe8dc Mon Sep 17 00:00:00 2001
From: Yue Hu <[email protected]>
Date: Wed, 23 Jan 2019 16:56:48 +0800
Subject: [PATCH] pstore/ram: Make initialization check as first one

Since only one single ramoops area allowed at a time, other probes include device tree related are meaningless, it will waste cpu consumtion. So let's check it firstly.

---
 fs/pstore/ram.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
fs/pstore/ram.c +9 -10
index 1adb5e3..ca01778 100644
@@ -715,15 +715,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.
@@ -733,6 +724,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");
--
Quoted 1 line

1.9.1

Applied, thanks!

Signature · 1 line
Kees Cook