diff options
author | Xin Xie <xxie@nvidia.com> | 2011-03-18 18:08:28 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:45:07 -0800 |
commit | 2d06fdb150df58be0a5842ebdab166a92efcec21 (patch) | |
tree | 9d443c76318dc5888996547262afb1be1c282e09 /drivers/watchdog | |
parent | 0e5eec3307ce47cb03f9405b1c227b400611b24b (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
Original-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>
Rebase-Id: Ra37e36461d02b1482bcb815dc554104cf552544d
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 1a73e36dc6cf..1763af7b0b21 100644 --- a/drivers/watchdog/tegra_wdt.c +++ b/drivers/watchdog/tegra_wdt.c @@ -69,7 +69,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) { @@ -112,8 +112,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; @@ -281,7 +280,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; @@ -317,7 +316,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; } |