From: Breno Leitao Date: Fri, 28 Feb 2025 12:50:18 +0000 (-0800) Subject: netconsole: Make boolean comparison consistent X-Git-Tag: io_uring-6.15-20250403~82^2~185^2~6 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=efb878fbe8d1fae3bf1974628e6d267dc861207e;p=linux-block.git netconsole: Make boolean comparison consistent Convert the current state assignment to use explicit boolean conversion, making the code more robust and easier to read. This change adds a double-negation operator to ensure consistent boolean conversion as suggested by Paolo[1]. This approach aligns with the existing pattern used in sysdata_cpu_nr_enabled_show(). Link: https://lore.kernel.org/all/7309e760-63b0-4b58-ad33-2fb8db361141@redhat.com/ [1] Signed-off-by: Breno Leitao Reviewed-by: Simon Horman Signed-off-by: Paolo Abeni --- diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index c086e2fe51f8..698dbbea2713 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -850,7 +850,7 @@ static ssize_t sysdata_cpu_nr_enabled_store(struct config_item *item, return ret; mutex_lock(&dynamic_netconsole_mutex); - curr = nt->sysdata_fields & SYSDATA_CPU_NR; + curr = !!(nt->sysdata_fields & SYSDATA_CPU_NR); if (cpu_nr_enabled == curr) /* no change requested */ goto unlock_ok;