diff mbox series

[v2,3/3] staging/fbtft: Fix braces coding style

Message ID 20210724151411.9531-4-len.baker@gmx.com (mailing list archive)
State Superseded, archived
Headers show
Series Remove all strcpy() uses | expand

Commit Message

Len Baker July 24, 2021, 3:14 p.m. UTC
Add braces to the "for" loop and remove braces from the "if" statement.
This way the kernel coding style is followed.

Signed-off-by: Len Baker <len.baker@gmx.com>
---
 drivers/staging/fbtft/fbtft-core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

--
2.25.1

Comments

Geert Uytterhoeven July 24, 2021, 6:01 p.m. UTC | #1
Hi Len,

On Sat, Jul 24, 2021 at 7:44 PM Len Baker <len.baker@gmx.com> wrote:
> Add braces to the "for" loop and remove braces from the "if" statement.
> This way the kernel coding style is followed.
>
> Signed-off-by: Len Baker <len.baker@gmx.com>

Thanks for your patch!

> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c

> @@ -1016,10 +1018,9 @@ int fbtft_init_display(struct fbtft_par *par)
>
>         i = 0;
>         while (i < FBTFT_MAX_INIT_SEQUENCE) {
> -               if (par->init_sequence[i] == -3) {
> -                       /* done */
> -                       return 0;
> -               }

These braces should not be removed, due to the presence of
the comment.

> +               if (par->init_sequence[i] == -3)
> +                       return 0; /* done */
> +
>                 if (par->init_sequence[i] >= 0) {
>                         dev_err(par->info->device,
>                                 "missing delimiter at position %d\n", i);

Gr{oetje,eeting}s,

                        Geert
Len Baker July 25, 2021, 2:02 p.m. UTC | #2
Hi,

On Sat, Jul 24, 2021 at 08:01:53PM +0200, Geert Uytterhoeven wrote:
> Hi Len,
>
> On Sat, Jul 24, 2021 at 7:44 PM Len Baker <len.baker@gmx.com> wrote:
> > Add braces to the "for" loop and remove braces from the "if" statement.
> > This way the kernel coding style is followed.
> >
> > Signed-off-by: Len Baker <len.baker@gmx.com>
>
> Thanks for your patch!
>
> > --- a/drivers/staging/fbtft/fbtft-core.c
> > +++ b/drivers/staging/fbtft/fbtft-core.c
>
> > @@ -1016,10 +1018,9 @@ int fbtft_init_display(struct fbtft_par *par)
> >
> >         i = 0;
> >         while (i < FBTFT_MAX_INIT_SEQUENCE) {
> > -               if (par->init_sequence[i] == -3) {
> > -                       /* done */
> > -                       return 0;
> > -               }
>
> These braces should not be removed, due to the presence of
> the comment.

Ok, I leave it as is.

Thanks,
Len
diff mbox series

Patch

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index cc2bee22f7ad..d87792649efe 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1003,9 +1003,11 @@  int fbtft_init_display(struct fbtft_par *par)
 	}

 	/* make sure stop marker exists */
-	for (i = 0; i < FBTFT_MAX_INIT_SEQUENCE; i++)
+	for (i = 0; i < FBTFT_MAX_INIT_SEQUENCE; i++) {
 		if (par->init_sequence[i] == -3)
 			break;
+	}
+
 	if (i == FBTFT_MAX_INIT_SEQUENCE) {
 		dev_err(par->info->device,
 			"missing stop marker at end of init sequence\n");
@@ -1016,10 +1018,9 @@  int fbtft_init_display(struct fbtft_par *par)

 	i = 0;
 	while (i < FBTFT_MAX_INIT_SEQUENCE) {
-		if (par->init_sequence[i] == -3) {
-			/* done */
-			return 0;
-		}
+		if (par->init_sequence[i] == -3)
+			return 0; /* done */
+
 		if (par->init_sequence[i] >= 0) {
 			dev_err(par->info->device,
 				"missing delimiter at position %d\n", i);