Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wmissing-braces in drivers/staging/kpc2000/kpc2000/cell_probe.c #455

Closed
nathanchance opened this issue Apr 24, 2019 · 2 comments
Closed
Assignees
Labels
-Wmissing-braces [BUG] linux-next This is an issue only seen in linux-next [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle

Comments

@nathanchance
Copy link
Member

drivers/staging/kpc2000/kpc2000/cell_probe.c:96:38: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    struct resource  resources[2] = {0};
                                     ^
                                     {}
drivers/staging/kpc2000/kpc2000/cell_probe.c:314:38: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    struct resource  resources[2] = {0};
                                     ^
                                     {}
2 warnings generated.

Patch sent: https://lore.kernel.org/lkml/20190424185742.7797-1-natechancellor@gmail.com/

@nathanchance nathanchance added [PATCH] Submitted A patch has been submitted for review -Wmissing-braces [BUG] linux-next This is an issue only seen in linux-next labels Apr 24, 2019
@nathanchance nathanchance self-assigned this Apr 24, 2019
fengguang pushed a commit to 0day-ci/linux that referenced this issue Apr 25, 2019
Clang warns:

drivers/staging/kpc2000/kpc2000/cell_probe.c:96:38: warning: suggest
braces around initialization of subobject [-Wmissing-braces]
    struct resource  resources[2] = {0};
                                     ^
                                     {}
drivers/staging/kpc2000/kpc2000/cell_probe.c:314:38: warning: suggest
braces around initialization of subobject [-Wmissing-braces]
    struct resource  resources[2] = {0};
                                     ^
                                     {}
2 warnings generated.

One way to fix these warnings is to add additional braces like Clang
suggests; however, there has been a bit of push back from some
maintainers, who just prefer memset as it is unambiguous, doesn't
depend on a particular compiler version, and properly initializes all
subobjects [1][2]. Do that here so there are no more warnings.

[1]: https://lore.kernel.org/lkml/022e41c0-8465-dc7a-a45c-64187ecd9684@amd.com/
[2]: https://lore.kernel.org/lkml/20181128.215241.702406654469517539.davem@davemloft.net/

Link: ClangBuiltLinux#455
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
fengguang pushed a commit to 0day-ci/linux that referenced this issue Apr 25, 2019
Clang warns:

drivers/staging/kpc2000/kpc2000/cell_probe.c:96:38: warning: suggest
braces around initialization of subobject [-Wmissing-braces]
    struct resource  resources[2] = {0};
                                     ^
                                     {}
drivers/staging/kpc2000/kpc2000/cell_probe.c:314:38: warning: suggest
braces around initialization of subobject [-Wmissing-braces]
    struct resource  resources[2] = {0};
                                     ^
                                     {}
2 warnings generated.

One way to fix these warnings is to add additional braces like Clang
suggests; however, there has been a bit of push back from some
maintainers, who just prefer memset as it is unambiguous, doesn't
depend on a particular compiler version, and properly initializes all
subobjects [1][2]. Do that here so there are no more warnings.

[1]: https://lore.kernel.org/lkml/022e41c0-8465-dc7a-a45c-64187ecd9684@amd.com/
[2]: https://lore.kernel.org/lkml/20181128.215241.702406654469517539.davem@davemloft.net/

Link: ClangBuiltLinux#455
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Apr 25, 2019
fengguang pushed a commit to 0day-ci/linux that referenced this issue Apr 26, 2019
Clang warns:

drivers/staging/kpc2000/kpc2000/cell_probe.c:96:38: warning: suggest
braces around initialization of subobject [-Wmissing-braces]
    struct resource  resources[2] = {0};
                                     ^
                                     {}
drivers/staging/kpc2000/kpc2000/cell_probe.c:314:38: warning: suggest
braces around initialization of subobject [-Wmissing-braces]
    struct resource  resources[2] = {0};
                                     ^
                                     {}
2 warnings generated.

One way to fix these warnings is to add additional braces like Clang
suggests; however, there has been a bit of push back from some
maintainers, who just prefer memset as it is unambiguous, doesn't
depend on a particular compiler version, and properly initializes all
subobjects [1][2]. Do that here so there are no more warnings.

[1]: https://lore.kernel.org/lkml/022e41c0-8465-dc7a-a45c-64187ecd9684@amd.com/
[2]: https://lore.kernel.org/lkml/20181128.215241.702406654469517539.davem@davemloft.net/

Link: ClangBuiltLinux#455
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
@nathanchance
Copy link
Member Author

-next only issue, which has been fixed: https://git.kernel.org/next/linux-next/c/3fcbb7d49cb7947711888a0e5905bc5cd90cab5d

@nathanchance nathanchance added [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle and removed [PATCH] Accepted A submitted patch has been accepted upstream labels Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wmissing-braces [BUG] linux-next This is an issue only seen in linux-next [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle
Projects
None yet
Development

No branches or pull requests

1 participant