diff mbox series

Fix unnecessary braces warning in ideapad-laptop.c

Message ID 20250115221751.233111-1-mpolkorny@gmail.com (mailing list archive)
State Changes Requested, archived
Headers show
Series Fix unnecessary braces warning in ideapad-laptop.c | expand

Commit Message

Matheus Polkorny Jan. 15, 2025, 10:17 p.m. UTC
Address checkpatch warning: "braces {} are not necessary
for any arm of this statement" in ideapad-laptop.c:1858

Signed-off-by: Matheus Polkorny <mpolkorny@gmail.com>
---
 drivers/platform/x86/ideapad-laptop.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Ilpo Järvinen Jan. 17, 2025, 4:40 p.m. UTC | #1
On Wed, 15 Jan 2025, Matheus Polkorny wrote:

> Address checkpatch warning: "braces {} are not necessary
> for any arm of this statement" in ideapad-laptop.c:1858
> 
> Signed-off-by: Matheus Polkorny <mpolkorny@gmail.com>

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".

> ---
>  drivers/platform/x86/ideapad-laptop.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index e980dd18e5f6..408e7d1cfcb0 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -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)
>
Matheus Polkorny Jan. 17, 2025, 6:51 p.m. UTC | #2
On 25/01/17 06:40, Ilpo Järvinen wrote:
> On Wed, 15 Jan 2025, Matheus Polkorny wrote:
> 
> > Address checkpatch warning: "braces {} are not necessary
> > for any arm of this statement" in ideapad-laptop.c:1858
> > 
> > Signed-off-by: Matheus Polkorny <mpolkorny@gmail.com>
> 
> 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".
> 
> > ---
> >  drivers/platform/x86/ideapad-laptop.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> > index e980dd18e5f6..408e7d1cfcb0 100644
> > --- a/drivers/platform/x86/ideapad-laptop.c
> > +++ b/drivers/platform/x86/ideapad-laptop.c
> > @@ -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)
> > 
> 
> -- 
>  i.
> 

Hi, thanks for the feedback.

I’ve updated the commit with the correct prefix as you suggested.

Thanks again for the guidance.
diff mbox series

Patch

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index e980dd18e5f6..408e7d1cfcb0 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -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)