Fix unnecessary braces warning in ideapad-laptop.c
PATCH 1/1 Fix unnecessary braces warning in ideapad-laptop.c
Address checkpatch warning: "braces {} are not necessary for any arm of this statement" in ideapad-laptop.c:1858
--- drivers/platform/x86/ideapad-laptop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/platform/x86/ideapad-laptop.c +2 -3
@@ -1633,11 +1633,10 @@ static int ideapad_kbd_bl_init(struct ideapad_private *priv)if (WARN_ON (priv->kbd_bl.initialized))return -EEXIST ; -if (ideapad_kbd_bl_check_tristate (priv->kbd_bl.type)) { +if (ideapad_kbd_bl_check_tristate (priv->kbd_bl.type)) priv->kbd_bl.led.max_brightness =2 ; - }else { +else priv->kbd_bl.led.max_brightness =1 ; - } brightness =ideapad_kbd_bl_brightness_get (priv);if (brightness <0 )
Signature · 1 line
2.45.2
Ilpo Järvinen
maintainerQuoted 4 lines · Matheus Polkorny
Address checkpatch warning: "braces {} are not necessary for any arm of this statement" in ideapad-laptop.c:1858
Signed-off-by Matheus Polkorny <[email protected]>
This too is lacking the correct prefixes in the subject.
Please don't use "fix" for non-fixes such as this (in the subject). "prefixes: Remove unnecessary braces" works as a good replacement.
Checkpatch is useful too for many things but running it over the codebase existing within the tree may return "issues" / "warnings" which are of minor importance such as this. While I can take this patch once the prefixes are corrected, I hope you don't end up spending most of your time on trivial changes such as this as in large numbers they will likely start to become a burden.
If checkpatch, on the other hand, finds a real logic problem or something that is truly misleading (e.g. misleading indentation), such patches would be much preferred over this kind of changes. So please don't take the above as "never use checkpatch for the in-tree code".
Quoted 23 lines
--- drivers/platform/x86/ideapad-laptop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/platform/x86/ideapad-laptop.c +2
-3@@ -1633,11 +1633,10 @@ static int ideapad_kbd_bl_init(struct ideapad_private *priv)if (WARN_ON (priv->kbd_bl.initialized))return -EEXIST ; -if (ideapad_kbd_bl_check_tristate (priv->kbd_bl.type)) { +if (ideapad_kbd_bl_check_tristate (priv->kbd_bl.type)) priv->kbd_bl.led.max_brightness =2 ; - }else { +else priv->kbd_bl.led.max_brightness =1 ; - } brightness =ideapad_kbd_bl_brightness_get (priv);if (brightness <0 )
Signature · 1 line
i.
Re: [PATCH v2] platform/x86: Remove unnecessary braces
Quoted 44 lines · Ilpo Järvinen
Quoted 4 lines · Matheus Polkorny
Address checkpatch warning: "braces {} are not necessary for any arm of this statement" in ideapad-laptop.c:1858
Signed-off-by Matheus Polkorny <[email protected]>This too is lacking the correct prefixes in the subject.
Please don't use "fix" for non-fixes such as this (in the subject). "prefixes: Remove unnecessary braces" works as a good replacement.
Checkpatch is useful too for many things but running it over the codebase existing within the tree may return "issues" / "warnings" which are of minor importance such as this. While I can take this patch once the prefixes are corrected, I hope you don't end up spending most of your time on trivial changes such as this as in large numbers they will likely start to become a burden.
If checkpatch, on the other hand, finds a real logic problem or something that is truly misleading (e.g. misleading indentation), such patches would be much preferred over this kind of changes. So please don't take the above as "never use checkpatch for the in-tree code".
Quoted 20 lines
--- drivers/platform/x86/ideapad-laptop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/platform/x86/ideapad-laptop.c +2
-3@@ -1633,11 +1633,10 @@ static int ideapad_kbd_bl_init(struct ideapad_private *priv)if (WARN_ON (priv->kbd_bl.initialized))return -EEXIST ; -if (ideapad_kbd_bl_check_tristate (priv->kbd_bl.type)) { +if (ideapad_kbd_bl_check_tristate (priv->kbd_bl.type)) priv->kbd_bl.led.max_brightness =2 ; - }else { +else priv->kbd_bl.led.max_brightness =1 ; - }
Quoted 7 lines
Quoted 3 lines
drivers/platform/x86/ideapad-laptop.c +0
-0brightness =ideapad_kbd_bl_brightness_get (priv);if (brightness <0 )Signature · 1 line
i.
Hi, thanks for the feedback.
I’ve updated the commit with the correct prefix as you suggested.
Thanks again for the guidance.
From 793892900d9d3795db82afb5cbe411dbdd1890c4 Mon Sep 17 00:00:00 2001
From: Matheus Polkorny <[email protected]>
Date: Fri, 17 Jan 2025 14:47:59 -0300
Subject: [PATCH v2] platform/x86: Remove unnecessary braces
Reported by checkpatch.pl
--- drivers/platform/x86/ideapad-laptop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/platform/x86/ideapad-laptop.c +2 -3
@@ -1633,11 +1633,10 @@ static int ideapad_kbd_bl_init(struct ideapad_private *priv)if (WARN_ON (priv->kbd_bl.initialized))return -EEXIST ; -if (ideapad_kbd_bl_check_tristate (priv->kbd_bl.type)) { +if (ideapad_kbd_bl_check_tristate (priv->kbd_bl.type)) priv->kbd_bl.led.max_brightness =2 ; - }else { +else priv->kbd_bl.led.max_brightness =1 ; - } brightness =ideapad_kbd_bl_brightness_get (priv);if (brightness <0 )
Signature · 1 line
2.45.2