diff mbox series

[3/5] hwmon: (dell-smm) Return -ENOIOCTLCMD instead of -EINVAL

Message ID 20211021175447.5380-4-W_Armin@gmx.de (mailing list archive)
State Superseded
Headers show
Series hwmon: (dell-smm) Miscellaneous Improvments | expand

Commit Message

Armin Wolf Oct. 21, 2021, 5:54 p.m. UTC
From: Armin Wolf <W_Armin@gmx.de>

Returning -ENOIOCTLCMD gives the callers a better
hint of what went wrong and is the recommended
behavior.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/hwmon/dell-smm-hwmon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.20.1

Comments

Pali Rohár Oct. 21, 2021, 6:17 p.m. UTC | #1
On Thursday 21 October 2021 19:54:45 W_Armin@gmx.de wrote:
> From: Armin Wolf <W_Armin@gmx.de>
> 
> Returning -ENOIOCTLCMD gives the callers a better
> hint of what went wrong and is the recommended
> behavior.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Acked-by: Pali Rohár <pali@kernel.org>

> ---
>  drivers/hwmon/dell-smm-hwmon.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
> index b0c591bb761a..5f0338b4a717 100644
> --- a/drivers/hwmon/dell-smm-hwmon.c
> +++ b/drivers/hwmon/dell-smm-hwmon.c
> @@ -18,6 +18,7 @@
>  #include <linux/delay.h>
>  #include <linux/dmi.h>
>  #include <linux/err.h>
> +#include <linux/errno.h>
>  #include <linux/hwmon.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
> @@ -516,7 +517,7 @@ i8k_ioctl_unlocked(struct file *fp, struct dell_smm_data *data, unsigned int cmd
>  		break;
> 
>  	default:
> -		return -EINVAL;
> +		return -ENOIOCTLCMD;
>  	}
> 
>  	if (val < 0)
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index b0c591bb761a..5f0338b4a717 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -18,6 +18,7 @@ 
 #include <linux/delay.h>
 #include <linux/dmi.h>
 #include <linux/err.h>
+#include <linux/errno.h>
 #include <linux/hwmon.h>
 #include <linux/init.h>
 #include <linux/module.h>
@@ -516,7 +517,7 @@  i8k_ioctl_unlocked(struct file *fp, struct dell_smm_data *data, unsigned int cmd
 		break;

 	default:
-		return -EINVAL;
+		return -ENOIOCTLCMD;
 	}

 	if (val < 0)