]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ramoops: update parameters only after successful init
authorKees Cook <kees@outflux.net>
Mon, 24 Oct 2011 15:00:24 +0000 (02:00 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 7 Nov 2011 02:40:34 +0000 (13:40 +1100)
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 <keescook@chromium.org>
Cc: Marco Stornelli <marco.stornelli@gmail.com>
Cc: Sergiu Iordache <sergiu@chromium.org>
Cc: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/char/ramoops.c

index 7c7f42a1f880cc81af6dafd89b73810c7eca34aa..c47489c037f9b19379fb6ebc905d35d5c9d013f0 100644 (file)
@@ -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: