drivers/spi/spi-bcm2835.c:153:8: warning: Excessive padding in 'struct bcm2835_spidev' (112 padding bytes, where 48 is optimal). Optimal fields order: clear_rx_cs, prepare_cs, clear_rx_desc, clear_rx_addr, consider reordering the fields or adding explicit...

From: kernel test robot
Date: Wed Jul 13 2022 - 03:56:15 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b047602d579b4fb028128a525f056bbdc890e7f0
commit: ec679bda639fe84b78d473526ae27c74dea383fb spi: bcm2835: Allow arbitrary number of slaves
date: 1 year, 1 month ago
config: arm-randconfig-c002-20220702 (https://download.01.org/0day-ci/archive/20220713/202207131504.oHGQ85fm-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project f7a80c3d08d4821e621fc88d6a2e435291f82dff)
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=ec679bda639fe84b78d473526ae27c74dea383fb
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ec679bda639fe84b78d473526ae27c74dea383fb
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)
fs/select.c:999:4: note: Execution continues on line 1010
break;
^
fs/select.c:1011:12: note: Calling 'do_poll'
fdcount = do_poll(head, &table, end_time);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/select.c:888:23: note: Assuming the condition is false
__poll_t busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0;
^~~~~~~~~~~~~~~~~~
fs/select.c:888:23: note: '?' condition is false
fs/select.c:892:6: note: 'end_time' is null
if (end_time && !end_time->tv_sec && !end_time->tv_nsec) {
^~~~~~~~
fs/select.c:892:15: note: Left side of '&&' is false
if (end_time && !end_time->tv_sec && !end_time->tv_nsec) {
^
fs/select.c:897:6: note: 'end_time' is null
if (end_time && !timed_out)
^~~~~~~~
fs/select.c:897:15: note: Left side of '&&' is false
if (end_time && !timed_out)
^
fs/select.c:900:2: note: Loop condition is true. Entering loop body
for (;;) {
^
fs/select.c:904:3: note: Loop condition is true. Entering loop body
for (walk = list; walk != NULL; walk = walk->next) {
^
fs/select.c:909:11: note: 'pfd' is not equal to 'pfd_end'
for (; pfd != pfd_end; pfd++) {
^~~
fs/select.c:909:4: note: Loop condition is true. Entering loop body
for (; pfd != pfd_end; pfd++) {
^
fs/select.c:917:9: note: Calling 'do_pollfd'
if (do_pollfd(pfd, pt, &can_busy_loop,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/select.c:855:2: note: Assigned value is garbage or undefined
int fd = pollfd->fd;
^ ~~~~~~~~~~
Suppressed 16 warnings (16 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.
16 warnings generated.
Suppressed 16 warnings (16 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.
17 warnings generated.
drivers/mfd/qcom-pm8xxx.c:557:2: warning: Value stored to 'rev' is never read [clang-analyzer-deadcode.DeadStores]
rev |= val << BITS_PER_BYTE;
^ ~~~~~~~~~~~~~~~~~~~~
drivers/mfd/qcom-pm8xxx.c:557:2: note: Value stored to 'rev' is never read
rev |= val << BITS_PER_BYTE;
^ ~~~~~~~~~~~~~~~~~~~~
Suppressed 16 warnings (15 in non-user code, 1 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
16 warnings generated.
drivers/i2c/algos/i2c-algo-pcf.c:322:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = pcf_doAddress(adap, pmsg);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/algos/i2c-algo-pcf.c:322:3: note: Value stored to 'ret' is never read
ret = pcf_doAddress(adap, pmsg);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
17 warnings generated.
>> drivers/spi/spi-bcm2835.c:153:8: warning: Excessive padding in 'struct bcm2835_spidev' (112 padding bytes, where 48 is optimal). Optimal fields order: clear_rx_cs, prepare_cs, clear_rx_desc, clear_rx_addr, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct bcm2835_spidev {
~~~~~~~^~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:153:8: note: Excessive padding in 'struct bcm2835_spidev' (112 padding bytes, where 48 is optimal). Optimal fields order: clear_rx_cs, prepare_cs, clear_rx_desc, clear_rx_addr, consider reordering the fields or adding explicit padding members
struct bcm2835_spidev {
~~~~~~~^~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1164:20: warning: Access to field 'device' results in a dereference of a null pointer (loaded from field 'dma_rx') [clang-analyzer-core.NullDereference]
dma_unmap_single(ctlr->dma_rx->device->dev,
^
drivers/spi/spi-bcm2835.c:1213:27: note: Calling 'spi_controller_get_devdata'
struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/spi/spi.h:675:2: note: Returning without writing to 'ctlr->dma_rx'
return dev_get_drvdata(&ctlr->dev);
^
drivers/spi/spi-bcm2835.c:1213:27: note: Returning from 'spi_controller_get_devdata'
struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1219:6: note: Assuming 'slv' is non-null
if (!slv) {
^~~~
drivers/spi/spi-bcm2835.c:1219:2: note: Taking false branch
if (!slv) {
^
drivers/spi/spi-bcm2835.c:1239:6: note: Assuming the condition is false
if (spi->mode & SPI_CPOL)
^~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1239:2: note: Taking false branch
if (spi->mode & SPI_CPOL)
^
drivers/spi/spi-bcm2835.c:1241:6: note: Assuming the condition is false
if (spi->mode & SPI_CPHA)
^~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1241:2: note: Taking false branch
if (spi->mode & SPI_CPHA)
^
drivers/spi/spi-bcm2835.c:1249:6: note: Assuming field 'dma_rx' is null
if (ctlr->dma_rx) {
^~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1249:2: note: Taking false branch
if (ctlr->dma_rx) {
^
drivers/spi/spi-bcm2835.c:1262:6: note: Assuming the condition is false
if (spi->mode & SPI_NO_CS)
^~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1262:2: note: Taking false branch
if (spi->mode & SPI_NO_CS)
^
drivers/spi/spi-bcm2835.c:1268:6: note: Assuming field 'cs_gpiod' is null
if (spi->cs_gpiod)
^~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1268:2: note: Taking false branch
if (spi->cs_gpiod)
^
drivers/spi/spi-bcm2835.c:1270:6: note: Assuming field 'chip_select' is <= 1
if (spi->chip_select > 1) {
^~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1270:2: note: Taking false branch
if (spi->chip_select > 1) {
^
drivers/spi/spi-bcm2835.c:1292:6: note: Assuming 'chip' is non-null
if (!chip)
^~~~~
drivers/spi/spi-bcm2835.c:1292:2: note: Taking false branch
if (!chip)
^
drivers/spi/spi-bcm2835.c:1299:2: note: Taking true branch
if (IS_ERR(spi->cs_gpiod)) {
^
drivers/spi/spi-bcm2835.c:1301:3: note: Control jumps to line 1311
goto err_cleanup;
^
drivers/spi/spi-bcm2835.c:1311:2: note: Calling 'bcm2835_spi_cleanup'
bcm2835_spi_cleanup(spi);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1160:6: note: Assuming field 'clear_rx_desc' is null
if (slv->clear_rx_desc)
^~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1160:2: note: Taking false branch
if (slv->clear_rx_desc)
^
drivers/spi/spi-bcm2835.c:1163:6: note: Assuming field 'clear_rx_addr' is not equal to 0
if (slv->clear_rx_addr)
^~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1163:2: note: Taking true branch
if (slv->clear_rx_addr)
^
drivers/spi/spi-bcm2835.c:1164:20: note: Access to field 'device' results in a dereference of a null pointer (loaded from field 'dma_rx')
dma_unmap_single(ctlr->dma_rx->device->dev,
^
include/linux/dma-mapping.h:427:61: note: expanded from macro 'dma_unmap_single'
#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0)
^
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
15 warnings generated.
Suppressed 15 warnings (15 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.
--
^~~~~~
kernel/trace/trace_events_hist.c:2495:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(cmd, key_field->field->name);
^~~~~~
kernel/trace/trace_events_hist.c:2495:3: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(cmd, key_field->field->name);
^~~~~~
kernel/trace/trace_events_hist.c:2500:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(cmd, ":synthetic_");
^~~~~~
kernel/trace/trace_events_hist.c:2500:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(cmd, ":synthetic_");
^~~~~~
kernel/trace/trace_events_hist.c:2501:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(cmd, field_name);
^~~~~~
kernel/trace/trace_events_hist.c:2501:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(cmd, field_name);
^~~~~~
kernel/trace/trace_events_hist.c:2502:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(cmd, "=");
^~~~~~
kernel/trace/trace_events_hist.c:2502:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(cmd, "=");
^~~~~~
kernel/trace/trace_events_hist.c:2503:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(cmd, field_name);
^~~~~~
kernel/trace/trace_events_hist.c:2503:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(cmd, field_name);
^~~~~~
kernel/trace/trace_events_hist.c:2508:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(cmd, " if ");
^~~~~~
kernel/trace/trace_events_hist.c:2508:3: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(cmd, " if ");
^~~~~~
kernel/trace/trace_events_hist.c:2509:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(cmd, saved_filter);
^~~~~~
kernel/trace/trace_events_hist.c:2509:3: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(cmd, saved_filter);
^~~~~~
kernel/trace/trace_events_hist.c:5233:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = event_hist_trigger_func(&trigger_hist_cmd, file,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_events_hist.c:5233:3: note: Value stored to 'ret' is never read
ret = event_hist_trigger_func(&trigger_hist_cmd, file,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_events_hist.c:5674:6: warning: Array access (from variable 'glob') results in a null pointer dereference [clang-analyzer-core.NullDereference]
if (glob[0] == '!')
^~~~
kernel/trace/trace_events_hist.c:5664:2: note: Assuming 'debug_locks' is 0
lockdep_assert_held(&event_mutex);
^
include/linux/lockdep.h:310:11: note: expanded from macro 'lockdep_assert_held'
WARN_ON(debug_locks && \
^~~~~~~~~~~
include/asm-generic/bug.h:119:25: note: expanded from macro 'WARN_ON'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
kernel/trace/trace_events_hist.c:5664:2: note: Left side of '&&' is false
lockdep_assert_held(&event_mutex);
^
include/linux/lockdep.h:310:23: note: expanded from macro 'lockdep_assert_held'
WARN_ON(debug_locks && \
^
kernel/trace/trace_events_hist.c:5664:2: note: Taking false branch
lockdep_assert_held(&event_mutex);
^
include/linux/lockdep.h:310:3: note: expanded from macro 'lockdep_assert_held'
WARN_ON(debug_locks && \
^
include/asm-generic/bug.h:120:2: note: expanded from macro 'WARN_ON'
if (unlikely(__ret_warn_on)) \
^
kernel/trace/trace_events_hist.c:5664:2: note: Loop condition is false. Exiting loop
lockdep_assert_held(&event_mutex);
^
include/linux/lockdep.h:309:32: note: expanded from macro 'lockdep_assert_held'
#define lockdep_assert_held(l) do { \
^
kernel/trace/trace_events_hist.c:5666:6: note: Assuming 'glob' is null
if (glob && strlen(glob)) {
^~~~
kernel/trace/trace_events_hist.c:5666:11: note: Left side of '&&' is false
if (glob && strlen(glob)) {
^
kernel/trace/trace_events_hist.c:5671:6: note: Assuming 'param' is non-null
if (!param)
^~~~~~
kernel/trace/trace_events_hist.c:5671:2: note: Taking false branch
if (!param)
^
kernel/trace/trace_events_hist.c:5674:6: note: Array access (from variable 'glob') results in a null pointer dereference
if (glob[0] == '!')
^~~~
Suppressed 17 warnings (16 in non-user code, 1 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.
17 warnings generated.
>> drivers/spi/spi-bcm2835.c:153:8: warning: Excessive padding in 'struct bcm2835_spidev' (112 padding bytes, where 48 is optimal). Optimal fields order: clear_rx_cs, prepare_cs, clear_rx_desc, clear_rx_addr, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct bcm2835_spidev {
~~~~~~~^~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:153:8: note: Excessive padding in 'struct bcm2835_spidev' (112 padding bytes, where 48 is optimal). Optimal fields order: clear_rx_cs, prepare_cs, clear_rx_desc, clear_rx_addr, consider reordering the fields or adding explicit padding members
struct bcm2835_spidev {
~~~~~~~^~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1164:20: warning: Access to field 'device' results in a dereference of a null pointer (loaded from field 'dma_rx') [clang-analyzer-core.NullDereference]
dma_unmap_single(ctlr->dma_rx->device->dev,
^
drivers/spi/spi-bcm2835.c:1213:27: note: Calling 'spi_controller_get_devdata'
struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/spi/spi.h:675:2: note: Returning without writing to 'ctlr->dma_rx'
return dev_get_drvdata(&ctlr->dev);
^
drivers/spi/spi-bcm2835.c:1213:27: note: Returning from 'spi_controller_get_devdata'
struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1219:6: note: Assuming 'slv' is non-null
if (!slv) {
^~~~
drivers/spi/spi-bcm2835.c:1219:2: note: Taking false branch
if (!slv) {
^
drivers/spi/spi-bcm2835.c:1239:6: note: Assuming the condition is false
if (spi->mode & SPI_CPOL)
^~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1239:2: note: Taking false branch
if (spi->mode & SPI_CPOL)
^
drivers/spi/spi-bcm2835.c:1241:6: note: Assuming the condition is false
if (spi->mode & SPI_CPHA)
^~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1241:2: note: Taking false branch
if (spi->mode & SPI_CPHA)
^
drivers/spi/spi-bcm2835.c:1249:6: note: Assuming field 'dma_rx' is null
if (ctlr->dma_rx) {
^~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1249:2: note: Taking false branch
if (ctlr->dma_rx) {
^
drivers/spi/spi-bcm2835.c:1262:6: note: Assuming the condition is false
if (spi->mode & SPI_NO_CS)
^~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1262:2: note: Taking false branch
if (spi->mode & SPI_NO_CS)
^
drivers/spi/spi-bcm2835.c:1268:6: note: Assuming field 'cs_gpiod' is null
if (spi->cs_gpiod)
^~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1268:2: note: Taking false branch
if (spi->cs_gpiod)
^
drivers/spi/spi-bcm2835.c:1270:6: note: Assuming field 'chip_select' is <= 1
if (spi->chip_select > 1) {
^~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1270:2: note: Taking false branch
if (spi->chip_select > 1) {
^
drivers/spi/spi-bcm2835.c:1292:6: note: Assuming 'chip' is non-null
if (!chip)
^~~~~
drivers/spi/spi-bcm2835.c:1292:2: note: Taking false branch
if (!chip)
^
drivers/spi/spi-bcm2835.c:1299:2: note: Taking true branch
if (IS_ERR(spi->cs_gpiod)) {
^
drivers/spi/spi-bcm2835.c:1301:3: note: Control jumps to line 1311
goto err_cleanup;
^
drivers/spi/spi-bcm2835.c:1311:2: note: Calling 'bcm2835_spi_cleanup'
bcm2835_spi_cleanup(spi);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1160:6: note: Assuming field 'clear_rx_desc' is null
if (slv->clear_rx_desc)
^~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1160:2: note: Taking false branch
if (slv->clear_rx_desc)
^
drivers/spi/spi-bcm2835.c:1163:6: note: Assuming field 'clear_rx_addr' is not equal to 0
if (slv->clear_rx_addr)
^~~~~~~~~~~~~~~~~~
drivers/spi/spi-bcm2835.c:1163:2: note: Taking true branch
if (slv->clear_rx_addr)
^
drivers/spi/spi-bcm2835.c:1164:20: note: Access to field 'device' results in a dereference of a null pointer (loaded from field 'dma_rx')
dma_unmap_single(ctlr->dma_rx->device->dev,
^
include/linux/dma-mapping.h:427:61: note: expanded from macro 'dma_unmap_single'
#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0)
^
Suppressed 15 warnings (15 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.
16 warnings generated.
Suppressed 16 warnings (16 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.
15 warnings generated.
Suppressed 15 warnings (15 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.

vim +153 drivers/spi/spi-bcm2835.c

142
143 /**
144 * struct bcm2835_spidev - BCM2835 SPI slave
145 * @prepare_cs: precalculated CS register value for ->prepare_message()
146 * (uses slave-specific clock polarity and phase settings)
147 * @clear_rx_desc: preallocated RX DMA descriptor used for TX-only transfers
148 * (cyclically clears RX FIFO by writing @clear_rx_cs to CS register)
149 * @clear_rx_addr: bus address of @clear_rx_cs
150 * @clear_rx_cs: precalculated CS register value to clear RX FIFO
151 * (uses slave-specific clock polarity and phase settings)
152 */
> 153 struct bcm2835_spidev {
154 u32 prepare_cs;
155 struct dma_async_tx_descriptor *clear_rx_desc;
156 dma_addr_t clear_rx_addr;
157 u32 clear_rx_cs ____cacheline_aligned;
158 };
159

--
0-DAY CI Kernel Test Service
https://01.org/lkp