All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/leds/flash/leds-mt6360.c:339:13: warning: use of uninitialized value '<unknown>' [CWE-457]
Date: Mon, 25 Jul 2022 16:37:46 +0800	[thread overview]
Message-ID: <202207251615.G7DbbDZh-lkp@intel.com> (raw)

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

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check warning: drivers/leds/flash/leds-mt6360.c:339:13: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]"
:::::: 

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Gene Chen <gene_chen@richtek.com>
CC: Pavel Machek <pavel@ucw.cz>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e0dccc3b76fb35bb257b4118367a883073d7390e
commit: 679f8652064bfa2f622c7b2bab86b1bf3207d6bc leds: Add mt6360 driver
date:   6 months ago
:::::: branch date: 12 hours ago
:::::: commit date: 6 months ago
config: arm-randconfig-c002-20220718 (https://download.01.org/0day-ci/archive/20220725/202207251615.G7DbbDZh-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=679f8652064bfa2f622c7b2bab86b1bf3207d6bc
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 679f8652064bfa2f622c7b2bab86b1bf3207d6bc
        # save the config file
         ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' 

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

gcc-analyzer warnings: (new ones prefixed by >>)
   drivers/leds/flash/leds-mt6360.c: In function 'mt6360_fault_get':
>> drivers/leds/flash/leds-mt6360.c:339:13: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     339 |         u16 fled_stat;
         |             ^~~~~~~~~
     'mt6360_fault_get': event 1
       |
       |  339 |         u16 fled_stat;
       |      |             ^~~~~~~~~
       |      |             |
       |      |             (1) use of uninitialized value '<unknown>' here
       |
   drivers/leds/flash/leds-mt6360.c:340:22: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     340 |         unsigned int chg_stat, strobe_timeout_mask, fled_short_mask;
         |                      ^~~~~~~~
     'mt6360_fault_get': event 1
       |
       |  340 |         unsigned int chg_stat, strobe_timeout_mask, fled_short_mask;
       |      |                      ^~~~~~~~
       |      |                      |
       |      |                      (1) use of uninitialized value '<unknown>' here
       |
   drivers/leds/flash/leds-mt6360.c: In function 'mt6360_isnk_init_default_state':
   drivers/leds/flash/leds-mt6360.c:391:22: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     391 |         unsigned int regval;
         |                      ^~~~~~
     'mt6360_isnk_init_default_state': event 1
       |
       |  391 |         unsigned int regval;
       |      |                      ^~~~~~
       |      |                      |
       |      |                      (1) use of uninitialized value '<unknown>' here
       |
   drivers/leds/flash/leds-mt6360.c: In function 'mt6360_flash_init_default_state':
   drivers/leds/flash/leds-mt6360.c:427:22: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     427 |         unsigned int regval;
         |                      ^~~~~~
     'mt6360_flash_init_default_state': event 1
       |
       |  427 |         unsigned int regval;
       |      |                      ^~~~~~
       |      |                      |
       |      |                      (1) use of uninitialized value '<unknown>' here
       |
   drivers/leds/flash/leds-mt6360.c: In function 'mt6360_init_isnk_properties':
   drivers/leds/flash/leds-mt6360.c:624:13: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     624 |         u32 val;
         |             ^~~
     'mt6360_init_isnk_properties': event 1
       |
       |  624 |         u32 val;
       |      |             ^~~
       |      |             |
       |      |             (1) use of uninitialized value '<unknown>' here
       |
   drivers/leds/flash/leds-mt6360.c:636:29: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     636 |                         u32 reg, color;
         |                             ^~~
     'mt6360_init_isnk_properties': events 1-3
       |
       |  627 |         if (led->led_no == MT6360_VIRTUAL_MULTICOLOR) {
       |      |            ^
       |      |            |
       |      |            (1) following 'true' branch...
       |......
       |  630 |                 sub_led = devm_kzalloc(priv->dev,
       |      |                           ~~~~~~~~~~~~~~~~~~~~~~~
       |      |                           |
       |      |                           (2) ...to here
       |  631 |                         sizeof(*sub_led) * MULTICOLOR_NUM_CHANNELS, GFP_KERNEL);
       |      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  632 |                 if (!sub_led)
       |      |                    ~
       |      |                    |
       |      |                    (3) following 'false' branch...
       |
     'mt6360_init_isnk_properties': event 4
       |
       |  635 |                 fwnode_for_each_child_node(init_data->fwnode, child) {
       |      |                                            ~~~~~~~~~^~~~~~~~
       |      |                                                     |
       |      |                                                     (4) ...to here
   include/linux/property.h:101:49: note: in definition of macro 'fwnode_for_each_child_node'
       |  101 |         for (child = fwnode_get_next_child_node(fwnode, NULL); child;   \
       |      |                                                 ^~~~~~
       |
     'mt6360_init_isnk_properties': event 5
       |
       |drivers/leds/flash/leds-mt6360.c:635:63:
       |  635 |                 fwnode_for_each_child_node(init_data->fwnode, child) {
       |      |                                                               ^~~~~
       |      |                                                               |
       |      |                                                               (5) following 'true' branch (when 'child' is non-NULL)...
   include/linux/property.h:101:64: note: in definition of macro 'fwnode_for_each_child_node'
       |  101 |         for (child = fwnode_get_next_child_node(fwnode, NULL); child;   \
       |      |                                                                ^~~~~
       |
     'mt6360_init_isnk_properties': events 6-7
       |
       |drivers/leds/flash/leds-mt6360.c:636:29:
       |  636 |                         u32 reg, color;
       |      |                             ^~~
       |      |                             |

vim +339 drivers/leds/flash/leds-mt6360.c

679f8652064bfa Gene Chen 2021-11-15  333  
679f8652064bfa Gene Chen 2021-11-15  334  static int mt6360_fault_get(struct led_classdev_flash *fl_cdev, u32 *fault)
679f8652064bfa Gene Chen 2021-11-15  335  {
679f8652064bfa Gene Chen 2021-11-15  336  	struct mt6360_led *led =
679f8652064bfa Gene Chen 2021-11-15  337  		container_of(fl_cdev, struct mt6360_led, flash);
679f8652064bfa Gene Chen 2021-11-15  338  	struct mt6360_priv *priv = led->priv;
679f8652064bfa Gene Chen 2021-11-15 @339  	u16 fled_stat;
679f8652064bfa Gene Chen 2021-11-15  340  	unsigned int chg_stat, strobe_timeout_mask, fled_short_mask;
679f8652064bfa Gene Chen 2021-11-15  341  	u32 rfault = 0;
679f8652064bfa Gene Chen 2021-11-15  342  	int ret;
679f8652064bfa Gene Chen 2021-11-15  343  
679f8652064bfa Gene Chen 2021-11-15  344  	mutex_lock(&priv->lock);
679f8652064bfa Gene Chen 2021-11-15  345  	ret = regmap_read(priv->regmap, MT6360_REG_CHGSTAT2, &chg_stat);
679f8652064bfa Gene Chen 2021-11-15  346  	if (ret)
679f8652064bfa Gene Chen 2021-11-15  347  		goto unlock;
679f8652064bfa Gene Chen 2021-11-15  348  
679f8652064bfa Gene Chen 2021-11-15  349  	ret = regmap_raw_read(priv->regmap, MT6360_REG_FLEDSTAT1, &fled_stat,
679f8652064bfa Gene Chen 2021-11-15  350  			      sizeof(fled_stat));
679f8652064bfa Gene Chen 2021-11-15  351  	if (ret)
679f8652064bfa Gene Chen 2021-11-15  352  		goto unlock;
679f8652064bfa Gene Chen 2021-11-15  353  
679f8652064bfa Gene Chen 2021-11-15  354  	if (led->led_no == MT6360_LED_FLASH1) {
679f8652064bfa Gene Chen 2021-11-15  355  		strobe_timeout_mask = MT6360_FLED1STRBTO_MASK;
679f8652064bfa Gene Chen 2021-11-15  356  		fled_short_mask = MT6360_FLED1SHORT_MASK;
679f8652064bfa Gene Chen 2021-11-15  357  	} else {
679f8652064bfa Gene Chen 2021-11-15  358  		strobe_timeout_mask = MT6360_FLED2STRBTO_MASK;
679f8652064bfa Gene Chen 2021-11-15  359  		fled_short_mask = MT6360_FLED2SHORT_MASK;
679f8652064bfa Gene Chen 2021-11-15  360  	}
679f8652064bfa Gene Chen 2021-11-15  361  
679f8652064bfa Gene Chen 2021-11-15  362  	if (chg_stat & MT6360_FLEDCHGVINOVP_MASK)
679f8652064bfa Gene Chen 2021-11-15  363  		rfault |= LED_FAULT_INPUT_VOLTAGE;
679f8652064bfa Gene Chen 2021-11-15  364  
679f8652064bfa Gene Chen 2021-11-15  365  	if (fled_stat & strobe_timeout_mask)
679f8652064bfa Gene Chen 2021-11-15  366  		rfault |= LED_FAULT_TIMEOUT;
679f8652064bfa Gene Chen 2021-11-15  367  
679f8652064bfa Gene Chen 2021-11-15  368  	if (fled_stat & fled_short_mask)
679f8652064bfa Gene Chen 2021-11-15  369  		rfault |= LED_FAULT_SHORT_CIRCUIT;
679f8652064bfa Gene Chen 2021-11-15  370  
679f8652064bfa Gene Chen 2021-11-15  371  	if (fled_stat & MT6360_FLEDLVF_MASK)
679f8652064bfa Gene Chen 2021-11-15  372  		rfault |= LED_FAULT_UNDER_VOLTAGE;
679f8652064bfa Gene Chen 2021-11-15  373  
679f8652064bfa Gene Chen 2021-11-15  374  	*fault = rfault;
679f8652064bfa Gene Chen 2021-11-15  375  unlock:
679f8652064bfa Gene Chen 2021-11-15  376  	mutex_unlock(&priv->lock);
679f8652064bfa Gene Chen 2021-11-15  377  	return ret;
679f8652064bfa Gene Chen 2021-11-15  378  }
679f8652064bfa Gene Chen 2021-11-15  379  

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

             reply	other threads:[~2022-07-25  8:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25  8:37 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-20  8:27 drivers/leds/flash/leds-mt6360.c:339:13: warning: use of uninitialized value '<unknown>' [CWE-457] kernel test robot

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=202207251615.G7DbbDZh-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.