2021-08-19 03:26:27

by kernel test robot

[permalink] [raw]
Subject: [kbuild] drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is optimal).

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 794c7931a2428a656551f2179e6a093233a6e0aa
commit: e7095c35abfc5a5d566941a87434c0fd5ffb570f regulator: core: add
of_match_full_name boolean flag
date: 9 months ago
:::::: branch date: 12 hours ago
:::::: commit date: 9 months ago
config: arm-randconfig-c002-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project
44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
-O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
#
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e7095c35abfc5a5d566941a87434c0fd5ffb570f
git remote add linus
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e7095c35abfc5a5d566941a87434c0fd5ffb570f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross
ARCH=arm clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
5 warnings generated.
drivers/regulator/as3722-regulator.c:46:8: warning: Excessive
padding in 'struct as3722_register_mapping' (14 padding bytes, where 2
is optimal).
Optimal fields order:
name,
sname,
n_voltages,
enable_reg,
control_reg,
sleep_ctrl_reg,
regulator_id,
vsel_reg,
vsel_mask,
enable_mask,
mode_mask,
sleep_ctrl_mask,
consider reordering the fields or adding explicit padding members
[clang-analyzer-optin.performance.Padding]
struct as3722_register_mapping {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/as3722-regulator.c:46:8: note: Excessive padding
in 'struct as3722_register_mapping' (14 padding bytes, where 2 is
optimal). Optimal fields order: name, sname, n_voltages, enable_reg,
control_reg, sleep_ctrl_reg, regulator_id, vsel_reg, vsel_mask,
enable_mask, mode_mask, sleep_ctrl_mask, consider reordering the fields
or adding explicit padding members
struct as3722_register_mapping {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
5 warnings generated.
>> drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive
padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is
optimal).
Optimal fields order:
dvs,
additional_inits,
additional_init_amnt,
init,
desc,
consider reordering the fields or adding explicit padding members
[clang-analyzer-optin.performance.Padding]
struct bd718xx_regulator_data {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/bd718x7-regulator.c:531:8: note: Excessive padding
in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is
optimal). Optimal fields order: dvs, additional_inits,
additional_init_amnt, init, desc, consider reordering the fields or
adding explicit padding members
struct bd718xx_regulator_data {
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
drivers/gpu/drm/drm_self_refresh_helper.c:85:3: warning: Value
stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = -ENOMEM;
^ ~~~~~~~
drivers/gpu/drm/drm_self_refresh_helper.c:85:3: note: Value stored
to 'ret' is never read
ret = -ENOMEM;
^ ~~~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
4 warnings generated.
drivers/gpu/drm/drm_fb_helper.c:156:24: warning: Value stored to
'helper' during its initialization is never read
[clang-analyzer-deadcode.DeadStores]
struct drm_fb_helper *helper = info->par;
^~~~~~ ~~~~~~~~~
drivers/gpu/drm/drm_fb_helper.c:156:24: note: Value stored to
'helper' during its initialization is never read
struct drm_fb_helper *helper = info->par;
^~~~~~ ~~~~~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers.
Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).

vim +531 drivers/regulator/bd718x7-regulator.c

ba08799e90b593 drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-05-30 525
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 526 struct reg_init {
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 527 unsigned int reg;
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 528 unsigned int mask;
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 529 unsigned int val;
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 530 };
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 @531 struct bd718xx_regulator_data {
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 532 struct regulator_desc desc;
21b72156ede8b7 drivers/regulator/bd718x7-regulator.c Matti Vaittinen
2020-01-20 533 const struct rohm_dvs_config dvs;
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 534 const struct reg_init init;
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 535 const struct reg_init *additional_inits;
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 536 int additional_init_amnt;
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 537 };
494edd266b945f drivers/regulator/bd71837-regulator.c Matti Vaittinen
2018-09-14 538

:::::: The code at line 531 was first introduced by commit
:::::: 494edd266b945f36908184433dd36eda1719cdb0 regulator/mfd: Support
ROHM BD71847 power management IC

:::::: TO: Matti Vaittinen <[email protected]>
:::::: CC: Mark Brown <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]


Attachments:
.config.gz (26.24 kB)

2021-08-19 05:36:17

by Matti Vaittinen

[permalink] [raw]
Subject: Re: [kbuild] drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is optimal).

Hi,

On Thu, Aug 19, 2021 at 6:26 AM kernel test robot <[email protected]> wrote:
> >> drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive
> padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is
> optimal).
> Optimal fields order:
> dvs,
> additional_inits,
> additional_init_amnt,
> init,
> desc,
> consider reordering the fields or adding explicit padding members
> [clang-analyzer-optin.performance.Padding]
> struct bd718xx_regulator_data {
> ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> drivers/regulator/bd718x7-regulator.c:531:8: note: Excessive padding
> in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is
> optimal). Optimal fields order: dvs, additional_inits,
> additional_init_amnt, init, desc, consider reordering the fields or
> adding explicit padding members
> struct bd718xx_regulator_data {
> ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

I don't have a good feeling about these checks. Especially when a
struct is composed of other structs - which may be modified
independently of the code we are looking at here. Any unrelated
addition of a member to any of the structs (well, maybe not the one at
the bottom). I guess fixing all the users of these structs when
something changes would cause quite a churn of changes... What is
expected to be done as a result from these mails?

Best Regards
-- Matti

2021-08-19 11:39:00

by Mark Brown

[permalink] [raw]
Subject: Re: [kbuild] drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is optimal).

On Thu, Aug 19, 2021 at 08:34:22AM +0300, Matti Vaittinen wrote:

> something changes would cause quite a churn of changes... What is
> expected to be done as a result from these mails?

It's probably fine to ignore them for something like this which is going
to get very few uses in the kernel - it gets a lot more interesting for
something that gets lots of copies allocated since that causes the bloat
to really add up.


Attachments:
(No filename) (432.00 B)
signature.asc (499.00 B)
Download all attachments

2021-08-19 14:51:20

by kernel test robot

[permalink] [raw]
Subject: Re: [kbuild] drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is optimal).

Hi,

On 8/19/2021 1:34 PM, Matti Vaittinen wrote:
> Hi,
>
> On Thu, Aug 19, 2021 at 6:26 AM kernel test robot <[email protected]> wrote:
>> >> drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive
>> padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is
>> optimal).
>> Optimal fields order:
>> dvs,
>> additional_inits,
>> additional_init_amnt,
>> init,
>> desc,
>> consider reordering the fields or adding explicit padding members
>> [clang-analyzer-optin.performance.Padding]
>> struct bd718xx_regulator_data {
>> ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/regulator/bd718x7-regulator.c:531:8: note: Excessive padding
>> in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is
>> optimal). Optimal fields order: dvs, additional_inits,
>> additional_init_amnt, init, desc, consider reordering the fields or
>> adding explicit padding members
>> struct bd718xx_regulator_data {
>> ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
>
> I don't have a good feeling about these checks. Especially when a
> struct is composed of other structs - which may be modified
> independently of the code we are looking at here. Any unrelated
> addition of a member to any of the structs (well, maybe not the one at
> the bottom). I guess fixing all the users of these structs when
> something changes would cause quite a churn of changes... What is
> expected to be done as a result from these mails?
>
> Best Regards
> -- Matti
>

Sorry for bothering, we'll ignore struct padding warnings next time.

Best Regards,
Yujie Liu

2021-08-19 15:29:33

by Mark Brown

[permalink] [raw]
Subject: Re: [kbuild] drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is optimal).

On Thu, Aug 19, 2021 at 10:49:13PM +0800, kernel test robot wrote:

> Sorry for bothering, we'll ignore struct padding warnings next time.

I think the warnings are useful, it's just that they're not important
for all structs. If the struct was getting allocated a lot it could be
pointing out an issue that makes a real difference. I'm not sure it s
realistic for automation to figure it out for itself so it's better to
send them even if they get ignored a lot.


Attachments:
(No filename) (475.00 B)
signature.asc (499.00 B)
Download all attachments

2021-08-21 04:40:32

by kernel test robot

[permalink] [raw]
Subject: Re: [kbuild] drivers/regulator/bd718x7-regulator.c:531:8: warning: Excessive padding in 'struct bd718xx_regulator_data' (8 padding bytes, where 0 is optimal).

Hi Mark,

On 8/19/2021 11:23 PM, Mark Brown wrote:
> On Thu, Aug 19, 2021 at 10:49:13PM +0800, kernel test robot wrote:
>
>> Sorry for bothering, we'll ignore struct padding warnings next time.
>
> I think the warnings are useful, it's just that they're not important
> for all structs. If the struct was getting allocated a lot it could be
> pointing out an issue that makes a real difference. I'm not sure it s
> realistic for automation to figure it out for itself so it's better to
> send them even if they get ignored a lot.
>

It's not very practical for automation to figure out how many copies of
a struct would be created and how much space would be saved in total by
adjusting struct padding.

For similar warnings in the future, we'll make an effort to do manual
check first, and send out reports that we think are worthy of notice.

Best Regards,
Yujie Liu