2019-12-09 20:15:52

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH] xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk

Clang warns:

../drivers/block/xen-blkfront.c:1117:4: warning: misleading indentation;
statement is not part of the previous 'if' [-Wmisleading-indentation]
nr_parts = PARTS_PER_DISK;
^
../drivers/block/xen-blkfront.c:1115:3: note: previous statement is here
if (err)
^

This is because there is a space at the beginning of this line; remove
it so that the indentation is consistent according to the Linux kernel
coding style and clang no longer warns.

While we are here, the previous line has some trailing whitespace; clean
that up as well.

Fixes: c80a420995e7 ("xen-blkfront: handle Xen major numbers other than XENVBD")
Link: https://github.com/ClangBuiltLinux/linux/issues/791
Signed-off-by: Nathan Chancellor <[email protected]>
---
drivers/block/xen-blkfront.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index a74d03913822..c02be06c5299 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1113,8 +1113,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
if (!VDEV_IS_EXTENDED(info->vdevice)) {
err = xen_translate_vdev(info->vdevice, &minor, &offset);
if (err)
- return err;
- nr_parts = PARTS_PER_DISK;
+ return err;
+ nr_parts = PARTS_PER_DISK;
} else {
minor = BLKIF_MINOR_EXT(info->vdevice);
nr_parts = PARTS_PER_EXT_DISK;
--
2.24.0


2019-12-09 21:08:54

by Nick Desaulniers

[permalink] [raw]
Subject: Re: [PATCH] xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk

On Mon, Dec 9, 2019 at 12:14 PM Nathan Chancellor
<[email protected]> wrote:
>
> Clang warns:
>
> ../drivers/block/xen-blkfront.c:1117:4: warning: misleading indentation;
> statement is not part of the previous 'if' [-Wmisleading-indentation]
> nr_parts = PARTS_PER_DISK;
> ^
> ../drivers/block/xen-blkfront.c:1115:3: note: previous statement is here
> if (err)
> ^
>
> This is because there is a space at the beginning of this line; remove
> it so that the indentation is consistent according to the Linux kernel
> coding style and clang no longer warns.
>
> While we are here, the previous line has some trailing whitespace; clean
> that up as well.
>
> Fixes: c80a420995e7 ("xen-blkfront: handle Xen major numbers other than XENVBD")
> Link: https://github.com/ClangBuiltLinux/linux/issues/791
> Signed-off-by: Nathan Chancellor <[email protected]>
> ---
> drivers/block/xen-blkfront.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index a74d03913822..c02be06c5299 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -1113,8 +1113,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,

While you're here, would you please also removing the single space
before the labels in this function?

In vim:

/^ [a-zA-Z]

turns up 5 labels with this.

> if (!VDEV_IS_EXTENDED(info->vdevice)) {
> err = xen_translate_vdev(info->vdevice, &minor, &offset);
> if (err)
> - return err;
> - nr_parts = PARTS_PER_DISK;
> + return err;
> + nr_parts = PARTS_PER_DISK;
> } else {
> minor = BLKIF_MINOR_EXT(info->vdevice);
> nr_parts = PARTS_PER_EXT_DISK;
> --
> 2.24.0
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20191209201444.33243-1-natechancellor%40gmail.com.



--
Thanks,
~Nick Desaulniers

2019-12-09 21:15:50

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH] xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk

On Mon, Dec 09, 2019 at 01:07:41PM -0800, Nick Desaulniers wrote:
> On Mon, Dec 9, 2019 at 12:14 PM Nathan Chancellor
> <[email protected]> wrote:
> >
> > Clang warns:
> >
> > ../drivers/block/xen-blkfront.c:1117:4: warning: misleading indentation;
> > statement is not part of the previous 'if' [-Wmisleading-indentation]
> > nr_parts = PARTS_PER_DISK;
> > ^
> > ../drivers/block/xen-blkfront.c:1115:3: note: previous statement is here
> > if (err)
> > ^
> >
> > This is because there is a space at the beginning of this line; remove
> > it so that the indentation is consistent according to the Linux kernel
> > coding style and clang no longer warns.
> >
> > While we are here, the previous line has some trailing whitespace; clean
> > that up as well.
> >
> > Fixes: c80a420995e7 ("xen-blkfront: handle Xen major numbers other than XENVBD")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/791
> > Signed-off-by: Nathan Chancellor <[email protected]>
> > ---
> > drivers/block/xen-blkfront.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> > index a74d03913822..c02be06c5299 100644
> > --- a/drivers/block/xen-blkfront.c
> > +++ b/drivers/block/xen-blkfront.c
> > @@ -1113,8 +1113,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
>
> While you're here, would you please also removing the single space
> before the labels in this function?
>
> In vim:
>
> /^ [a-zA-Z]
>
> turns up 5 labels with this.

That should probably be a separate patch since there are only two labels
in the function I am touching here. I'll whip up a v2 if the maintainers
want it though or I'll just draft a separate patch when I am done
addressing all of the misleading indentation warnings.

Thanks for the reply!
Nathan

2019-12-10 05:37:24

by Jürgen Groß

[permalink] [raw]
Subject: Re: [PATCH] xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk

On 09.12.19 22:07, Nick Desaulniers wrote:
> On Mon, Dec 9, 2019 at 12:14 PM Nathan Chancellor
> <[email protected]> wrote:
>>
>> Clang warns:
>>
>> ../drivers/block/xen-blkfront.c:1117:4: warning: misleading indentation;
>> statement is not part of the previous 'if' [-Wmisleading-indentation]
>> nr_parts = PARTS_PER_DISK;
>> ^
>> ../drivers/block/xen-blkfront.c:1115:3: note: previous statement is here
>> if (err)
>> ^
>>
>> This is because there is a space at the beginning of this line; remove
>> it so that the indentation is consistent according to the Linux kernel
>> coding style and clang no longer warns.
>>
>> While we are here, the previous line has some trailing whitespace; clean
>> that up as well.
>>
>> Fixes: c80a420995e7 ("xen-blkfront: handle Xen major numbers other than XENVBD")
>> Link: https://github.com/ClangBuiltLinux/linux/issues/791
>> Signed-off-by: Nathan Chancellor <[email protected]>
>> ---
>> drivers/block/xen-blkfront.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index a74d03913822..c02be06c5299 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -1113,8 +1113,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
>
> While you're here, would you please also removing the single space
> before the labels in this function?

AFAIK those are intended to be there.

Having labels indented by a space makes diff not believe those are
function declarations. So a patching a function with a label won't show
the label, but the function in the diff block header.


Juergen

2019-12-10 07:17:30

by Jürgen Groß

[permalink] [raw]
Subject: Re: [PATCH] xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk

On 09.12.19 21:14, Nathan Chancellor wrote:
> Clang warns:
>
> ../drivers/block/xen-blkfront.c:1117:4: warning: misleading indentation;
> statement is not part of the previous 'if' [-Wmisleading-indentation]
> nr_parts = PARTS_PER_DISK;
> ^
> ../drivers/block/xen-blkfront.c:1115:3: note: previous statement is here
> if (err)
> ^
>
> This is because there is a space at the beginning of this line; remove
> it so that the indentation is consistent according to the Linux kernel
> coding style and clang no longer warns.
>
> While we are here, the previous line has some trailing whitespace; clean
> that up as well.
>
> Fixes: c80a420995e7 ("xen-blkfront: handle Xen major numbers other than XENVBD")
> Link: https://github.com/ClangBuiltLinux/linux/issues/791
> Signed-off-by: Nathan Chancellor <[email protected]>

Reviewed-by: Juergen Gross <[email protected]>


Juergen

2019-12-10 11:28:11

by Roger Pau Monne

[permalink] [raw]
Subject: Re: [PATCH] xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk

On Tue, Dec 10, 2019 at 08:15:22AM +0100, J?rgen Gro? wrote:
> On 09.12.19 21:14, Nathan Chancellor wrote:
> > Clang warns:
> >
> > ../drivers/block/xen-blkfront.c:1117:4: warning: misleading indentation;
> > statement is not part of the previous 'if' [-Wmisleading-indentation]
> > nr_parts = PARTS_PER_DISK;
> > ^
> > ../drivers/block/xen-blkfront.c:1115:3: note: previous statement is here
> > if (err)
> > ^
> >
> > This is because there is a space at the beginning of this line; remove
> > it so that the indentation is consistent according to the Linux kernel
> > coding style and clang no longer warns.
> >
> > While we are here, the previous line has some trailing whitespace; clean
> > that up as well.
> >
> > Fixes: c80a420995e7 ("xen-blkfront: handle Xen major numbers other than XENVBD")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/791
> > Signed-off-by: Nathan Chancellor <[email protected]>
>
> Reviewed-by: Juergen Gross <[email protected]>

Acked-by: Roger Pau Monn? <[email protected]>

Thanks.

2019-12-20 12:40:59

by Jürgen Groß

[permalink] [raw]
Subject: Re: [PATCH] xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk

On 09.12.19 21:14, Nathan Chancellor wrote:
> Clang warns:
>
> ../drivers/block/xen-blkfront.c:1117:4: warning: misleading indentation;
> statement is not part of the previous 'if' [-Wmisleading-indentation]
> nr_parts = PARTS_PER_DISK;
> ^
> ../drivers/block/xen-blkfront.c:1115:3: note: previous statement is here
> if (err)
> ^
>
> This is because there is a space at the beginning of this line; remove
> it so that the indentation is consistent according to the Linux kernel
> coding style and clang no longer warns.
>
> While we are here, the previous line has some trailing whitespace; clean
> that up as well.
>
> Fixes: c80a420995e7 ("xen-blkfront: handle Xen major numbers other than XENVBD")
> Link: https://github.com/ClangBuiltLinux/linux/issues/791
> Signed-off-by: Nathan Chancellor <[email protected]>

Pushed to xen/tip.git for-linus-5.5b


Juergen