From 087ce7301b95cd92a1b0d97ee495c0b3518f48ef Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 14 Apr 2015 19:36:50 +0530 Subject: gpu: nvgpu: return error if GPU not initialized While writing to sysfs "tpc_fs_mask", we need to have GPU initialized (we need to have called gk20a_busy() at least once before) If this is not happened yet, then return error Bug 1456969 Change-Id: I09db6bcaa44b8939246cb5ed1205f3fbc0ee0552 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/731327 (cherry picked from commit 0dbbcf60bbad6b9a31392d2290a3e26c5daa1e5d) Reviewed-on: http://git-master/r/731671 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sachin Nikam --- drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 4fea0779..5fe10273 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c @@ -615,6 +615,9 @@ static ssize_t tpc_fs_mask_store(struct device *device, if (kstrtoul(buf, 10, &val) < 0) return -EINVAL; + if (!g->gr.gpc_tpc_mask) + return -ENODEV; + if (val && val != g->gr.gpc_tpc_mask[0] && g->ops.gr.set_gpc_tpc_mask) { g->gr.gpc_tpc_mask[0] = val; -- cgit v1.2.2