]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: dc: limit access to win_h sysfs
authorJon Mayo <jmayo@nvidia.com>
Tue, 26 Nov 2013 19:15:49 +0000 (11:15 -0800)
committerJon Mayo <jmayo@nvidia.com>
Mon, 2 Dec 2013 18:29:27 +0000 (10:29 -0800)
Return error when display is powered down for reads or writes to win_h.

Bug 1412225

Change-Id: I6df22cede222ff2f0ff381c0941dab2e7d08eabb
Signed-off-by: Jon Mayo <jmayo@nvidia.com>
Reviewed-on: http://git-master/r/335744
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit

drivers/video/tegra/dc/dc_sysfs.c

index 1c574af51b9cf7436fbe192ceef8786ce3d5537a..c9343d11824226c4e979494f34317a72b30ba79d 100644 (file)
@@ -135,7 +135,7 @@ static ssize_t enable_store(struct device *dev,
        return count;
 }
 
-static DEVICE_ATTR(enable, S_IRUGO|S_IWUSR, enable_show, enable_store);
+static DEVICE_ATTR(enable, S_IRUSR | S_IWUSR, enable_show, enable_store);
 
 #ifdef CONFIG_TEGRA_DC_WIN_H
 static ssize_t win_h_show(struct device *device,
@@ -145,6 +145,9 @@ static ssize_t win_h_show(struct device *device,
        struct tegra_dc *dc = platform_get_drvdata(ndev);
        unsigned long val = 0;
 
+       if (!dc->enabled)
+               return -EIO; /* not powered */
+
        mutex_lock(&dc->lock);
        tegra_dc_io_start(dc);
 
@@ -169,7 +172,7 @@ static ssize_t win_h_store(struct device *dev,
 
        if (!dc->enabled) {
                dev_err(&dc->ndev->dev, "%s: DC not enabled.\n", __func__);
-               return -EFAULT;
+               return -EIO; /* not powered */
        }
 
        if (kstrtouint(buf, 10, &val) < 0)