lkml.org 
[lkml]   [2019]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] pstore/ram: Make initialization check as first one
On Sun, Jan 27, 2019 at 6:11 PM Yue Hu <huyue2@yulong.com> wrote:
>
> From 4320c0fcb5d685c8099937abce88e0b7fbbfe8dc Mon Sep 17 00:00:00 2001
> From: Yue Hu <huyue2@yulong.com>
> 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.
>
> Signed-off-by: Yue Hu <huyue2@yulong.com>
> ---
> 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 1adb5e3..ca01778 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -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");
> --
> 1.9.1

Applied, thanks!

--
Kees Cook

\
 
 \ /
  Last update: 2019-02-12 21:13    [W:0.035 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site