From 16a737893271dd7aa5d7a28995953d6f274aa5db Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Nov 2011 10:41:51 +1100 Subject: [PATCH] ramoops: update parameters only after successful init If a platform device exists on the system, but ramoops fails to attach to it, the module parameters are overridden before ramoops can fall back and try to use passed module parameters. Move update to end of init routine. Signed-off-by: Kees Cook Cc: Marco Stornelli Cc: Sergiu Iordache Cc: Seiji Aguchi Signed-off-by: Andrew Morton --- drivers/char/ramoops.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c index 7c7f42a1f880..c47489c037f9 100644 --- a/drivers/char/ramoops.c +++ b/drivers/char/ramoops.c @@ -148,14 +148,6 @@ static int __init ramoops_probe(struct platform_device *pdev) cxt->phys_addr = pdata->mem_address; cxt->record_size = pdata->record_size; cxt->dump_oops = pdata->dump_oops; - /* - * Update the module parameter variables as well so they are visible - * through /sys/module/ramoops/parameters/ - */ - mem_size = pdata->mem_size; - mem_address = pdata->mem_address; - record_size = pdata->record_size; - dump_oops = pdata->dump_oops; if (!request_mem_region(cxt->phys_addr, cxt->size, "ramoops")) { pr_err("request mem region failed\n"); @@ -176,6 +168,15 @@ static int __init ramoops_probe(struct platform_device *pdev) goto fail1; } + /* + * Update the module parameter variables as well so they are visible + * through /sys/module/ramoops/parameters/ + */ + mem_size = pdata->mem_size; + mem_address = pdata->mem_address; + record_size = pdata->record_size; + dump_oops = pdata->dump_oops; + return 0; fail1: -- 2.39.2