diff options
author | Seshendra Gadagottu <sgadagottu@nvidia.com> | 2016-06-27 13:33:55 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-06-27 19:02:44 -0400 |
commit | 8b45a5e016438dc4f020959ab89390de5eb353ed (patch) | |
tree | 116d9d2fd5471b3109decf173b7f1ca3fc67b3a3 /drivers | |
parent | 61d4e27607c0ce4080ef02daeb09200181662337 (diff) |
gpu: nvgpu: fix coverity issues in sysfs/debugfs
Fix coverity issues in debugfs related to null check
before accessing data member.
Fix coverity issues in sysfs related to error code
over-write and unintilized error code.
coverity ids: 20087564, 20087460, 20087461
Bug 200192125
Change-Id: If82288fca18464dca7093ce10f0beb1272489609
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: http://git-master/r/1171943
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 5 |
2 files changed, 14 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c index f1e1f98a..a57a3c74 100644 --- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c | |||
@@ -381,22 +381,22 @@ void gk20a_debug_init(struct device *dev) | |||
381 | if (platform->debugfs) { | 381 | if (platform->debugfs) { |
382 | platform->debugfs_alias = | 382 | platform->debugfs_alias = |
383 | debugfs_create_symlink("gpu.0", NULL, dev_name(dev)); | 383 | debugfs_create_symlink("gpu.0", NULL, dev_name(dev)); |
384 | } | ||
385 | 384 | ||
386 | debugfs_create_file("status", S_IRUGO, platform->debugfs, | 385 | debugfs_create_file("status", S_IRUGO, platform->debugfs, |
387 | dev, &gk20a_debug_fops); | 386 | dev, &gk20a_debug_fops); |
388 | debugfs_create_file("gr_status", S_IRUGO, platform->debugfs, | 387 | debugfs_create_file("gr_status", S_IRUGO, platform->debugfs, |
389 | dev, &gk20a_gr_debug_fops); | 388 | dev, &gk20a_gr_debug_fops); |
390 | debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, platform->debugfs, | 389 | debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, |
391 | &gk20a_debug_trace_cmdbuf); | 390 | platform->debugfs, &gk20a_debug_trace_cmdbuf); |
392 | 391 | ||
393 | debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR, | 392 | debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR, |
394 | platform->debugfs, &platform->ch_wdt_timeout_ms); | 393 | platform->debugfs, &platform->ch_wdt_timeout_ms); |
395 | 394 | ||
396 | #if defined(GK20A_DEBUG) | 395 | #if defined(GK20A_DEBUG) |
397 | debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR, platform->debugfs, | 396 | debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR, |
398 | &gk20a_dbg_mask); | 397 | platform->debugfs, &gk20a_dbg_mask); |
399 | debugfs_create_u32("dbg_ftrace", S_IRUGO|S_IWUSR, platform->debugfs, | 398 | debugfs_create_u32("dbg_ftrace", S_IRUGO|S_IWUSR, |
400 | &gk20a_dbg_ftrace); | 399 | platform->debugfs, &gk20a_dbg_ftrace); |
401 | #endif | 400 | #endif |
401 | } | ||
402 | } | 402 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 119030f9..127d0258 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -284,7 +284,7 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
284 | struct generic_pm_domain *genpd = dev_to_genpd(dev); | 284 | struct generic_pm_domain *genpd = dev_to_genpd(dev); |
285 | struct gk20a *g = get_gk20a(dev); | 285 | struct gk20a *g = get_gk20a(dev); |
286 | unsigned long railgate_enable = 0; | 286 | unsigned long railgate_enable = 0; |
287 | int err; | 287 | int err = 0; |
288 | 288 | ||
289 | if (kstrtoul(buf, 10, &railgate_enable) < 0) | 289 | if (kstrtoul(buf, 10, &railgate_enable) < 0) |
290 | return -EINVAL; | 290 | return -EINVAL; |
@@ -309,6 +309,9 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
309 | err = platform->unrailgate(dev); | 309 | err = platform->unrailgate(dev); |
310 | mutex_unlock(&platform->railgate_lock); | 310 | mutex_unlock(&platform->railgate_lock); |
311 | } | 311 | } |
312 | if (err) | ||
313 | return err; | ||
314 | |||
312 | dev_info(dev, "railgate is %s.\n", platform->can_railgate ? | 315 | dev_info(dev, "railgate is %s.\n", platform->can_railgate ? |
313 | "enabled" : "disabled"); | 316 | "enabled" : "disabled"); |
314 | /* wake-up system to make railgating_enable effective immediately */ | 317 | /* wake-up system to make railgating_enable effective immediately */ |