gpu: nvgpu: add debug msg in ioctl ZBC_SET_TABLE
Gagan Grover [Tue, 15 Dec 2015 06:18:08 +0000 (11:18 +0530)]
Print failure message in ioctl NVGPU_GPU_IOCTL_ZBC_SET_TABLE

Bug 200158661

Change-Id: Idfc7b7cc2a64c92bf7c947708de30b5f0151f877
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/922910
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gaurav Singh <gauravsingh@nvidia.com>
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>

drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c

index f705d55..7b05a27 100644 (file)
@@ -590,8 +590,10 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
                set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf;
 
                zbc_val = kzalloc(sizeof(struct zbc_entry), GFP_KERNEL);
-               if (zbc_val == NULL)
+               if (zbc_val == NULL) {
+                       gk20a_err(dev_from_gk20a(g), "Failed to allocate memory for zbc_entry\n");
                        return -ENOMEM;
+               }
 
                zbc_val->format = set_table_args->format;
                zbc_val->type = set_table_args->type;
@@ -607,12 +609,18 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
                        zbc_val->depth = set_table_args->depth;
                        break;
                default:
+                       gk20a_err(dev_from_gk20a(g),
+                               "Invalid argument, %d didn't match to any GK20A_ZBC_TYPE\n",
+                               zbc_val->type);
                        err = -EINVAL;
                }
 
                if (!err) {
                        err = gk20a_busy(dev);
-                       if (!err) {
+                       if (err) {
+                               gk20a_err(dev_from_gk20a(g),
+                                       "failed to power on gpu: %d\n", err);
+                       } else {
                                err = g->ops.gr.zbc_set_table(g, &g->gr,
                                                             zbc_val);
                                gk20a_idle(dev);