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>
This commit is contained in:
@@ -717,15 +717,6 @@ static int ramoops_probe(struct platform_device *pdev)
|
|||||||
phys_addr_t paddr;
|
phys_addr_t paddr;
|
||||||
int err = -EINVAL;
|
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
|
* Only a single ramoops area allowed at a time, so fail extra
|
||||||
* probes.
|
* probes.
|
||||||
@@ -735,6 +726,15 @@ static int ramoops_probe(struct platform_device *pdev)
|
|||||||
goto fail_out;
|
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. */
|
/* Make sure we didn't get bogus platform data pointer. */
|
||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
pr_err("NULL platform data\n");
|
pr_err("NULL platform data\n");
|
||||||
|
Reference in New Issue
Block a user