tegra: ictlr: fix crash when an IRQ fire during the probe
Alban Bedel [Tue, 10 Mar 2015 11:19:45 +0000 (16:19 +0530)]
The IRQ handler use drvdata, however drvdata was set *after*
registering the IRQ handler. If an IRQ fired before drvdata was set it
would crash the kernel. Fix this by setting drvdata before registering
the IRQ handler.

Bug 200081502

Change-Id: Id8578b2446b167d2b3131bc6f28820fc6f5d9e11
Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/715722
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

drivers/platform/tegra/hier_ictlr/hier_ictlr.c

index 1859d97..dbc65d6 100644 (file)
@@ -160,6 +160,8 @@ static int tegra_hier_ictlr_probe(struct platform_device *pdev)
        if (!ictlr)
                return -ENOMEM;
 
+       dev_set_drvdata(&pdev->dev, ictlr);
+
        ret = tegra_hier_ictlr_map_memory(pdev, ictlr);
        if (ret)
                return ret;
@@ -176,7 +178,6 @@ static int tegra_hier_ictlr_probe(struct platform_device *pdev)
 
        dev_notice(&pdev->dev, "probed\n");
 
-       dev_set_drvdata(&pdev->dev, ictlr);
        return 0;
 }