habanalabs: replace some -ENOTTY with -EINVAL
authorOded Gabbay <ogabbay@kernel.org>
Sun, 19 Dec 2021 14:06:59 +0000 (16:06 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Sun, 26 Dec 2021 06:59:10 +0000 (08:59 +0200)
-ENOTTY is returned in case of error in the ioctl arguments themselves,
such as function that doesn't exists.

In all other cases, where the error is in the arguments of the custom
data structures that we define that are passed in the various ioctls,
we need to return -EINVAL.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/command_buffer.c
drivers/misc/habanalabs/common/habanalabs_ioctl.c
drivers/misc/habanalabs/common/memory.c

index d4eb9fb..e7534b5 100644 (file)
@@ -475,7 +475,7 @@ int hl_cb_ioctl(struct hl_fpriv *hpriv, void *data)
                break;
 
        default:
-               rc = -ENOTTY;
+               rc = -EINVAL;
                break;
        }
 
index f571641..7ddf70a 100644 (file)
@@ -693,7 +693,7 @@ static int _hl_info_ioctl(struct hl_fpriv *hpriv, void *data,
 
        default:
                dev_err(dev, "Invalid request %d\n", args->op);
-               rc = -ENOTTY;
+               rc = -EINVAL;
                break;
        }
 
@@ -748,7 +748,7 @@ static int hl_debug_ioctl(struct hl_fpriv *hpriv, void *data)
 
        default:
                dev_err(hdev->dev, "Invalid request %d\n", args->op);
-               rc = -ENOTTY;
+               rc = -EINVAL;
                break;
        }
 
index e5f7b23..b859684 100644 (file)
@@ -2031,7 +2031,7 @@ static int mem_ioctl_no_mmu(struct hl_fpriv *hpriv, union hl_mem_args *args)
 
        default:
                dev_err(hdev->dev, "Unknown opcode for memory IOCTL\n");
-               rc = -ENOTTY;
+               rc = -EINVAL;
                break;
        }
 
@@ -2156,7 +2156,7 @@ int hl_mem_ioctl(struct hl_fpriv *hpriv, void *data)
 
        default:
                dev_err(hdev->dev, "Unknown opcode for memory IOCTL\n");
-               rc = -ENOTTY;
+               rc = -EINVAL;
                break;
        }