linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: sysrq: delete unnecessary check
@ 2025-08-06 11:46 Dan Carpenter
  2025-08-07  5:14 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-08-06 11:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Dmitry Safonov
  Cc: Jiri Slaby, linux-kernel, linux-serial, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: sysrq: delete unnecessary check
  2025-08-06 11:46 [PATCH] Input: sysrq: delete unnecessary check Dan Carpenter
@ 2025-08-07  5:14 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2025-08-07  5:14 UTC (permalink / raw)
  To: Dan Carpenter, Greg Kroah-Hartman, Dmitry Safonov
  Cc: linux-kernel, linux-serial, kernel-janitors

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-07  5:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 11:46 [PATCH] Input: sysrq: delete unnecessary check Dan Carpenter
2025-08-07  5:14 ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).