[PATCH] Input: sysrq: delete unnecessary check

Dan Carpenter posted 1 patch 1 month, 4 weeks ago
drivers/tty/sysrq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] Input: sysrq: delete unnecessary check
Posted by Dan Carpenter 1 month, 4 weeks ago
This code checks if (write) is true twice in a row.  It's more
readable to delete the first check.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/tty/sysrq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 97f8a9a52285..1f78b0db3b25 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -1133,8 +1133,7 @@ static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
 	 * Behaves like do_proc_dointvec as t does not have min nor max.
 	 */
 	ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos);
-
-	if (ret || !write)
+	if (ret)
 		return ret;
 
 	if (write)
-- 
2.47.2
Re: [PATCH] Input: sysrq: delete unnecessary check
Posted by Jiri Slaby 1 month, 4 weeks ago
On 06. 08. 25, 13:46, Dan Carpenter wrote:
> This code checks if (write) is true twice in a row.  It's more
> readable to delete the first check.

Not sure why "Input" in $SUBJ, but regardless:

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

thanks,
-- 
js
suse labs