FROMLIST: pstore-ram: fix NULL reference when used with pdata
authorBrian Norris <briannorris@google.com>
Mon, 14 Mar 2016 20:34:44 +0000 (13:34 -0700)
committerBrian Norris <briannorris@google.com>
Mon, 14 Mar 2016 20:34:44 +0000 (13:34 -0700)
When using platform-data (not DT), we get an OOPS, because drvdata is
only initialized after we try to use it.

This addresses my comments made on the upstream submission here:

https://patchwork.kernel.org/patch/7980651/

Fixes boot on Chrome OS systems, including the Pixel 2.

Change-Id: I97360edf2ce61c83dc543cb6c169f3287e2dae4b
Fixes: b1d1b7187c11 ("FROMLIST: pstore-ram: add Device Tree bindings")
Signed-off-by: Brian Norris <briannorris@google.com>
fs/pstore/ram.c

index 2429c804cf783afdeb4ce19d8a502cb427b85a8c..414041342a998d659c621320e86daa6dc3d57f32 100644 (file)
@@ -554,7 +554,7 @@ static int ramoops_parse_dt(struct platform_device *pdev,
 static int ramoops_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
-       struct ramoops_platform_data *pdata = platform_get_drvdata(pdev);
+       struct ramoops_platform_data *pdata = pdev->dev.platform_data;
        struct ramoops_context *cxt = &oops_cxt;
        size_t dump_mem_sz;
        phys_addr_t paddr;
@@ -666,7 +666,6 @@ static int ramoops_probe(struct platform_device *pdev)
                cxt->size, (unsigned long long)cxt->phys_addr,
                cxt->ecc_info.ecc_size, cxt->ecc_info.block_size);
 
-       platform_set_drvdata(pdev, pdata);
        return 0;
 
 fail_buf: