diff options
author | Xin Xie <xxie@nvidia.com> | 2011-03-18 18:08:28 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-03-21 16:57:28 -0800 |
commit | c04a044757f3a6959e7c4d5df30cb02fc8470a94 (patch) | |
tree | b75ec757deff34d8791f4a1281cb2c860ed30dd3 /drivers/watchdog | |
parent | b2322737dfcf2a0e8a2f95c375e4d57d0bac8a2d (diff) |
watchdog: tegra_wdt: fix WDT open() kernel panic
Opening the Tegra WDT device from user space is causing the kernel
panic. It is found that the device file private data pointer is passing
incorrectly in the orignal code.
bug 786885
Change-Id: I4646b02c5a804c07d05ba01e35034408cc8e3e4e
Reviewed-on: http://git-master/r/23629
Reviewed-by: Xin Xie <xxie@nvidia.com>
Tested-by: Xin Xie <xxie@nvidia.com>
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/tegra_wdt.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c index d11b99816ca6..b46fd206a662 100644 --- a/drivers/watchdog/tegra_wdt.c +++ b/drivers/watchdog/tegra_wdt.c @@ -65,7 +65,7 @@ struct tegra_wdt { bool enabled; }; -static struct tegra_wdt *tegra_wdt_dev; +static struct platform_device *tegra_wdt_dev; static void tegra_wdt_enable(struct tegra_wdt *wdt) { @@ -108,8 +108,7 @@ static int tegra_wdt_notify(struct notifier_block *this, static int tegra_wdt_open(struct inode *inode, struct file *file) { - struct miscdevice *miscdev = file->private_data; - struct tegra_wdt *wdt = dev_get_drvdata(miscdev->parent); + struct tegra_wdt *wdt = platform_get_drvdata(tegra_wdt_dev); if (test_and_set_bit(1, &wdt->users)) return -EBUSY; @@ -277,7 +276,7 @@ static int tegra_wdt_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, wdt); - tegra_wdt_dev = wdt; + tegra_wdt_dev = pdev; #ifdef CONFIG_TEGRA_WATCHDOG_ENABLE_ON_PROBE wdt->enabled = true; wdt->timeout = heartbeat; @@ -313,7 +312,7 @@ static int tegra_wdt_remove(struct platform_device *pdev) release_mem_region(wdt->res_src->start, resource_size(wdt->res_src)); release_mem_region(wdt->res_wdt->start, resource_size(wdt->res_wdt)); kfree(wdt); - tegra_wdt_dev = NULL; + platform_set_drvdata(pdev, NULL); return 0; } |