[<prev] [next>] [day] [month] [year] [list]
Message-ID: <6ac4b277-b8ff-4ffa-8786-80f7709155e2@kili.mountain>
Date: Wed, 17 May 2023 20:34:21 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev, Mia Lin <mimi05633@...il.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Alexandre Belloni <alexandre.belloni@...tlin.com>
Subject: drivers/rtc/rtc-nct3018y.c:112 nct3018y_get_alarm_mode() error: we
previously assumed 'alarm_enable' could be null (see line 96)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6
commit: 5adbaed16cc63542057627642d2414f603f2db69 rtc: Add NCT3018Y real time clock driver
config: microblaze-randconfig-m031-20230517
compiler: microblaze-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>
| Closes: https://lore.kernel.org/r/202305180042.DEzW1pSd-lkp@intel.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) {
^^^^^^^^^^^^
If these are NULL
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) {
^^^^^^^^^^
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);
^^^^^^^^^^^^^^^^^^^^^^^^^^
The debug code will crash.
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://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists