OSDN Git Service

coresight: hwtracing: fix dangling pointer issues
authorCharan Teja Reddy <charante@codeaurora.org>
Tue, 13 Sep 2016 12:16:41 +0000 (17:46 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Wed, 5 Oct 2016 08:34:45 +0000 (01:34 -0700)
Fix the dangling pointer issues on CoreSight that can cause the kernel
panic.

Change-Id: Ic20405cf2f64c6bc38e994780577b7da42cf6aba
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
drivers/hwtracing/coresight/coresight-csr.c
drivers/hwtracing/coresight/coresight-stm.c
drivers/soc/qcom/jtag-fuse.c

index dfb2922..3c18d68 100644 (file)
@@ -191,8 +191,6 @@ static int csr_probe(struct platform_device *pdev)
        drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
        if (!drvdata)
                return -ENOMEM;
-       /* Store the driver data pointer for use in exported functions */
-       csrdrvdata = drvdata;
        drvdata->dev = &pdev->dev;
        platform_set_drvdata(pdev, drvdata);
 
@@ -220,6 +218,8 @@ static int csr_probe(struct platform_device *pdev)
        if (IS_ERR(drvdata->csdev))
                return PTR_ERR(drvdata->csdev);
 
+       /* Store the driver data pointer for use in exported functions */
+       csrdrvdata = drvdata;
        dev_info(dev, "CSR initialized\n");
        return 0;
 }
index a234d61..fb2f272 100644 (file)
@@ -774,8 +774,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
        drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
        if (!drvdata)
                return -ENOMEM;
-       /* Store the driver data pointer for use in exported functions */
-       stmdrvdata = drvdata;
        drvdata->dev = &adev->dev;
        dev_set_drvdata(dev, drvdata);
 
@@ -846,6 +844,8 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
        if (boot_enable)
                coresight_enable(drvdata->csdev);
 
+       /* Store the driver data pointer for use in exported functions */
+       stmdrvdata = drvdata;
        return 0;
 err:
        coresight_unregister(drvdata->csdev);
index 0b05ce9..0f34772 100644 (file)
@@ -152,8 +152,6 @@ static int jtag_fuse_probe(struct platform_device *pdev)
        drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
        if (!drvdata)
                return -ENOMEM;
-       /* Store the driver data pointer for use in exported functions */
-       fusedrvdata = drvdata;
        drvdata->dev = &pdev->dev;
        platform_set_drvdata(pdev, drvdata);
 
@@ -174,6 +172,8 @@ static int jtag_fuse_probe(struct platform_device *pdev)
        if (!drvdata->base)
                return -ENOMEM;
 
+       /* Store the driver data pointer for use in exported functions */
+       fusedrvdata = drvdata;
        dev_info(dev, "JTag Fuse initialized\n");
        return 0;
 }