Messages in this thread | | | From | Nick Desaulniers <> | Date | Wed, 6 Jul 2022 13:30:59 -0700 | Subject | Re: drivers/iio/adc/ad7476.c:29:8: warning: Excessive padding in 'struct ad7476_chip_info' (10 padding bytes, where 2 is optimal). Optimal fields order: reset, channel, convst_channel, int_vref_uv, has_vref, has_vdrive, consider reordering the fields or |
| |
On Wed, Jul 6, 2022 at 5:45 AM Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote: > > > > > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > > 21 warnings generated. > > >> drivers/iio/adc/ad7476.c:29:8: warning: Excessive padding in 'struct ad7476_chip_info' (10 padding bytes, where 2 is optimal). Optimal fields order: reset, channel, convst_channel, int_vref_uv, has_vref, has_vdrive, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] > > struct ad7476_chip_info { > > ~~~~~~~^~~~~~~~~~~~~~~~~~ > > drivers/iio/adc/ad7476.c:29:8: note: Excessive padding in 'struct ad7476_chip_info' (10 padding bytes, where 2 is optimal). Optimal fields order: reset, channel, convst_channel, int_vref_uv, has_vref, has_vdrive, consider reordering the fields or adding explicit padding members > > struct ad7476_chip_info { > > ~~~~~~~^~~~~~~~~~~~~~~~~~ > > >> drivers/iio/adc/ad7476.c:39:8: warning: Excessive padding in 'struct ad7476_state' (472 padding bytes, where 216 is optimal). Optimal fields order: data, spi, chip_info, ref_reg, convst_gpio, msg, xfer, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] > > struct ad7476_state { > > For this one and I'm guessing some of the other IIO cases, if there is any way to suppress the warning where we have specific > alignments specified then that would be great. These are padded to ensure the buffers are DMA safe.
I didn't see anything during a quick scan of: https://github.com/llvm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp#L73 to disable this warning when it's a false positive.
Though https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics mentions NOLINT.
> > Thanks, > > Jonathan > > > > ~~~~~~~^~~~~~~~~~~~~~ > > drivers/iio/adc/ad7476.c:39:8: note: Excessive padding in 'struct ad7476_state' (472 padding bytes, where 216 is optimal). Optimal fields order: data, spi, chip_info, ref_reg, convst_gpio, msg, xfer, consider reordering the fields or adding explicit padding members > > struct ad7476_state { > > ~~~~~~~^~~~~~~~~~~~~~ > > Suppressed 19 warnings (7 in non-user code, 12 with check filters). > > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > > 20 warnings generated. > > drivers/iio/adc/ad7766.c:35:8: warning: Excessive padding in 'struct ad7766' (392 padding bytes, where 136 is optimal). Optimal fields order: data, chip_info, spi, mclk, pd_gpio, trig, reg, msg, xfer, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] > > struct ad7766 { > > ~~~~~~~^~~~~~~~ > > drivers/iio/adc/ad7766.c:35:8: note: Excessive padding in 'struct ad7766' (392 padding bytes, where 136 is optimal). Optimal fields order: data, chip_info, spi, mclk, pd_gpio, trig, reg, msg, xfer, consider reordering the fields or adding explicit padding members > > struct ad7766 { > > ~~~~~~~^~~~~~~~ > > Suppressed 19 warnings (7 in non-user code, 12 with check filters). > > Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. > > 20 warnings generated. > > drivers/iio/adc/ad7768-1.c:154:8: warning: Excessive padding in 'struct ad7768_state' (388 padding bytes, where 132 is optimal). Optimal fields order: data, mclk_freq, spi, vref, mclk, trig, gpio_sync_in, labels, lock, completion, samp_freq, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] > > struct ad7768_state { > > ~~~~~~~^~~~~~~~~~~~~~ > > drivers/iio/adc/ad7768-1.c:154:8: note: Excessive padding in 'struct ad7768_state' (388 padding bytes, where 132 is optimal). Optimal fields order: data, mclk_freq, spi, vref, mclk, trig, gpio_sync_in, labels, lock, completion, samp_freq, consider reordering the fields or adding explicit padding members > > struct ad7768_state { > > ~~~~~~~^~~~~~~~~~~~~~ >
-- Thanks, ~Nick Desaulniers
| |