All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/mtd/nand/raw/pl35x-nand-controller.c:1126:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
Date: Sun, 13 Feb 2022 08:25:23 +0800	[thread overview]
Message-ID: <202202130809.TZexhBcc-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 16715 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Miquel Raynal <miquel.raynal@bootlin.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   83e396641110663d3c7bb25b9bc0c6a750359ecf
commit: 08d8c62164a322eb923034acacf25246b775593a mtd: rawnand: pl353: Add support for the ARM PL353 SMC NAND controller
date:   8 months ago
:::::: branch date: 27 hours ago
:::::: commit date: 8 months ago
config: arm-randconfig-c002-20220211 (https://download.01.org/0day-ci/archive/20220213/202202130809.TZexhBcc-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project f6685f774697c85d6a352dcea013f46a99f9fe31)
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=08d8c62164a322eb923034acacf25246b775593a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 08d8c62164a322eb923034acacf25246b775593a
        # save the config file 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 <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                       ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:483:3: note: '?' condition is false
                   if (!PL35X_SMC_ECC_VALUE_IS_VALID(ecc_value))
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:483:3: note: '?' condition is false
                   if (!PL35X_SMC_ECC_VALUE_IS_VALID(ecc_value))
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:483:3: note: Taking false branch
                   if (!PL35X_SMC_ECC_VALUE_IS_VALID(ecc_value))
                   ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:486:3: note: Assuming the condition is true
                   if (PL35X_SMC_ECC_VALUE_HAS_FAILED(ecc_value)) {
                   ^
   include/linux/compiler.h:56:45: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:486:3: note: '?' condition is false
                   if (PL35X_SMC_ECC_VALUE_HAS_FAILED(ecc_value)) {
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:486:3: note: '?' condition is false
                   if (PL35X_SMC_ECC_VALUE_HAS_FAILED(ecc_value)) {
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:486:3: note: Taking false branch
                   if (PL35X_SMC_ECC_VALUE_HAS_FAILED(ecc_value)) {
                   ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:491:3: note: Calling 'pl35x_nand_ecc_reg_to_array'
                   pl35x_nand_ecc_reg_to_array(chip, ecc_value, calc_ecc);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:446:21: note: Assuming 'ecc_byte' is < field 'bytes'
           for (ecc_byte = 0; ecc_byte < chip->ecc.bytes; ecc_byte++)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:446:2: note: Loop condition is true.  Entering loop body
           for (ecc_byte = 0; ecc_byte < chip->ecc.bytes; ecc_byte++)
           ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:446:21: note: Assuming 'ecc_byte' is < field 'bytes'
           for (ecc_byte = 0; ecc_byte < chip->ecc.bytes; ecc_byte++)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:446:2: note: Loop condition is true.  Entering loop body
           for (ecc_byte = 0; ecc_byte < chip->ecc.bytes; ecc_byte++)
           ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:446:21: note: Assuming 'ecc_byte' is >= field 'bytes'
           for (ecc_byte = 0; ecc_byte < chip->ecc.bytes; ecc_byte++)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:446:2: note: Loop condition is false. Execution continues on line 446
           for (ecc_byte = 0; ecc_byte < chip->ecc.bytes; ecc_byte++)
           ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:491:3: note: Returning from 'pl35x_nand_ecc_reg_to_array'
                   pl35x_nand_ecc_reg_to_array(chip, ecc_value, calc_ecc);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:492:11: note: Calling 'pl35x_nand_correct_data'
                   stats = pl35x_nand_correct_data(nfc, data, read_ecc, calc_ecc);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:411:54: note: The left operand of '<<' is a garbage value
           calc_ecc_upper = ((calc_ecc[1] >> 4) | (calc_ecc[2] << 4)) &
                                                   ~~~~~~~~~~~ ^
>> drivers/mtd/nand/raw/pl35x-nand-controller.c:1126:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
           return ret;
           ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:1132:33: note: Left side of '&&' is false
           struct amba_device *smc_amba = to_amba_device(smc_dev);
                                          ^
   include/linux/amba/bus.h:103:27: note: expanded from macro 'to_amba_device'
   #define to_amba_device(d)       container_of(d, struct amba_device, dev)
                                   ^
   include/linux/kernel.h:704:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:1132:33: note: '?' condition is true
           struct amba_device *smc_amba = to_amba_device(smc_dev);
                                          ^
   include/linux/amba/bus.h:103:27: note: expanded from macro 'to_amba_device'
   #define to_amba_device(d)       container_of(d, struct amba_device, dev)
                                   ^
   include/linux/kernel.h:704:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:1132:33: note: Left side of '&&' is false
           struct amba_device *smc_amba = to_amba_device(smc_dev);
                                          ^
   include/linux/amba/bus.h:103:27: note: expanded from macro 'to_amba_device'
   #define to_amba_device(d)       container_of(d, struct amba_device, dev)
                                   ^
   include/linux/kernel.h:704:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:1132:33: note: Taking false branch
           struct amba_device *smc_amba = to_amba_device(smc_dev);
                                          ^
   include/linux/amba/bus.h:103:27: note: expanded from macro 'to_amba_device'
   #define to_amba_device(d)       container_of(d, struct amba_device, dev)
                                   ^
   include/linux/kernel.h:704:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:1132:33: note: Loop condition is false.  Exiting loop
           struct amba_device *smc_amba = to_amba_device(smc_dev);
                                          ^
   include/linux/amba/bus.h:103:27: note: expanded from macro 'to_amba_device'
   #define to_amba_device(d)       container_of(d, struct amba_device, dev)
                                   ^
   include/linux/kernel.h:704:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/mtd/nand/raw/pl35x-nand-controller.c:1137:6: note: Assuming 'nfc' is non-null
           if (!nfc)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   drivers/mtd/nand/raw/pl35x-nand-controller.c:1137:2: note: '?' condition is false
           if (!nfc)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^

vim +1126 drivers/mtd/nand/raw/pl35x-nand-controller.c

08d8c62164a322 Miquel Raynal 2021-06-10  1104  
08d8c62164a322 Miquel Raynal 2021-06-10  1105  static int pl35x_nand_chips_init(struct pl35x_nandc *nfc)
08d8c62164a322 Miquel Raynal 2021-06-10  1106  {
08d8c62164a322 Miquel Raynal 2021-06-10  1107  	struct device_node *np = nfc->dev->of_node, *nand_np;
08d8c62164a322 Miquel Raynal 2021-06-10  1108  	int nchips = of_get_child_count(np);
08d8c62164a322 Miquel Raynal 2021-06-10  1109  	int ret;
08d8c62164a322 Miquel Raynal 2021-06-10  1110  
08d8c62164a322 Miquel Raynal 2021-06-10  1111  	if (!nchips || nchips > PL35X_NAND_MAX_CS) {
08d8c62164a322 Miquel Raynal 2021-06-10  1112  		dev_err(nfc->dev, "Incorrect number of NAND chips (%d)\n",
08d8c62164a322 Miquel Raynal 2021-06-10  1113  			nchips);
08d8c62164a322 Miquel Raynal 2021-06-10  1114  		return -EINVAL;
08d8c62164a322 Miquel Raynal 2021-06-10  1115  	}
08d8c62164a322 Miquel Raynal 2021-06-10  1116  
08d8c62164a322 Miquel Raynal 2021-06-10  1117  	for_each_child_of_node(np, nand_np) {
08d8c62164a322 Miquel Raynal 2021-06-10  1118  		ret = pl35x_nand_chip_init(nfc, nand_np);
08d8c62164a322 Miquel Raynal 2021-06-10  1119  		if (ret) {
08d8c62164a322 Miquel Raynal 2021-06-10  1120  			of_node_put(nand_np);
08d8c62164a322 Miquel Raynal 2021-06-10  1121  			pl35x_nand_chips_cleanup(nfc);
08d8c62164a322 Miquel Raynal 2021-06-10  1122  			break;
08d8c62164a322 Miquel Raynal 2021-06-10  1123  		}
08d8c62164a322 Miquel Raynal 2021-06-10  1124  	}
08d8c62164a322 Miquel Raynal 2021-06-10  1125  
08d8c62164a322 Miquel Raynal 2021-06-10 @1126  	return ret;
08d8c62164a322 Miquel Raynal 2021-06-10  1127  }
08d8c62164a322 Miquel Raynal 2021-06-10  1128  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

                 reply	other threads:[~2022-02-13  0:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202202130809.TZexhBcc-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.