public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Mia Lin <mimi05633@gmail.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: drivers/rtc/rtc-nct3018y.c:112 nct3018y_get_alarm_mode() error: we previously assumed 'alarm_enable' could be null (see line 96)
Date: Mon, 22 Aug 2022 11:27:31 +0300	[thread overview]
Message-ID: <202208211110.jFk2KTL5-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   15b3f48a4339e3c16acf18624e2b7f60bc5e9a2c
commit: 5adbaed16cc63542057627642d2414f603f2db69 rtc: Add NCT3018Y real time clock driver
config: arm64-randconfig-m031-20220821 (https://download.01.org/0day-ci/archive/20220821/202208211110.jFk2KTL5-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/rtc/rtc-nct3018y.c:112 nct3018y_get_alarm_mode() error: we previously assumed 'alarm_enable' could be null (see line 96)
drivers/rtc/rtc-nct3018y.c:112 nct3018y_get_alarm_mode() error: we previously assumed 'alarm_flag' could be null (see line 104)

vim +/alarm_enable +112 drivers/rtc/rtc-nct3018y.c

5adbaed16cc635 Mia Lin 2022-07-13   91  static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *alarm_enable,
5adbaed16cc635 Mia Lin 2022-07-13   92  				   unsigned char *alarm_flag)
5adbaed16cc635 Mia Lin 2022-07-13   93  {
5adbaed16cc635 Mia Lin 2022-07-13   94  	int flags;
5adbaed16cc635 Mia Lin 2022-07-13   95  
5adbaed16cc635 Mia Lin 2022-07-13  @96  	if (alarm_enable) {
5adbaed16cc635 Mia Lin 2022-07-13   97  		dev_dbg(&client->dev, "%s:NCT3018Y_REG_CTRL\n", __func__);
5adbaed16cc635 Mia Lin 2022-07-13   98  		flags =  i2c_smbus_read_byte_data(client, NCT3018Y_REG_CTRL);
5adbaed16cc635 Mia Lin 2022-07-13   99  		if (flags < 0)
5adbaed16cc635 Mia Lin 2022-07-13  100  			return flags;
5adbaed16cc635 Mia Lin 2022-07-13  101  		*alarm_enable = flags & NCT3018Y_BIT_AIE;
5adbaed16cc635 Mia Lin 2022-07-13  102  	}
5adbaed16cc635 Mia Lin 2022-07-13  103  
5adbaed16cc635 Mia Lin 2022-07-13 @104  	if (alarm_flag) {
                                                    ^^^^^^^^^^
These can be NULL

5adbaed16cc635 Mia Lin 2022-07-13  105  		dev_dbg(&client->dev, "%s:NCT3018Y_REG_ST\n", __func__);
5adbaed16cc635 Mia Lin 2022-07-13  106  		flags =  i2c_smbus_read_byte_data(client, NCT3018Y_REG_ST);
5adbaed16cc635 Mia Lin 2022-07-13  107  		if (flags < 0)
5adbaed16cc635 Mia Lin 2022-07-13  108  			return flags;
5adbaed16cc635 Mia Lin 2022-07-13  109  		*alarm_flag = flags & NCT3018Y_BIT_AF;
5adbaed16cc635 Mia Lin 2022-07-13  110  	}
5adbaed16cc635 Mia Lin 2022-07-13  111  
5adbaed16cc635 Mia Lin 2022-07-13 @112  	dev_dbg(&client->dev, "%s:alarm_enable:%x alarm_flag:%x\n",
5adbaed16cc635 Mia Lin 2022-07-13  113  		__func__, *alarm_enable, *alarm_flag);
                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
Dereferenced in debug code.

5adbaed16cc635 Mia Lin 2022-07-13  114  
5adbaed16cc635 Mia Lin 2022-07-13  115  	return 0;
5adbaed16cc635 Mia Lin 2022-07-13  116  }

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


             reply	other threads:[~2022-08-22  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22  8:27 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-17 17:34 drivers/rtc/rtc-nct3018y.c:112 nct3018y_get_alarm_mode() error: we previously assumed 'alarm_enable' could be null (see line 96) Dan Carpenter

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=202208211110.jFk2KTL5-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mimi05633@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox