CC: [email protected] CC: [email protected] BCC: [email protected] CC: [email protected] TO: Claudiu Beznea <[email protected]> CC: Stephen Boyd <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 268db333b561c77dee3feb6831806412293b4a7e commit: 7029db09b2025f863f191b3d5b1d7859a5e26a8d clk: at91: clk-master: add notifier for divider date: 7 months ago :::::: branch date: 3 hours ago :::::: commit date: 7 months ago config: arm-randconfig-c002-20220524 (https://download.01.org/0day-ci/archive/20220525/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 10c9ecce9f6096e18222a331c5e7d085bd813f75) 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=7029db09b2025f863f191b3d5b1d7859a5e26a8d git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 7029db09b2025f863f191b3d5b1d7859a5e26a8d # 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 <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) fs/nilfs2/recovery.c:409:9: note: Loop condition is false. Exiting loop ent = list_first_entry(head, struct nilfs_segment_entry, list); ^ include/linux/list.h:522:2: note: expanded from macro 'list_first_entry' list_entry((ptr)->next, type, member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert' do { \ ^ fs/nilfs2/recovery.c:411:3: note: Memory is released kfree(ent); ^~~~~~~~~~ fs/nilfs2/recovery.c:406:2: note: Loop condition is true. Entering loop body while (!list_empty(head)) { ^ fs/nilfs2/recovery.c:409:9: note: Left side of '&&' is false ent = list_first_entry(head, struct nilfs_segment_entry, list); ^ include/linux/list.h:522:2: note: expanded from macro 'list_first_entry' list_entry((ptr)->next, type, member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:495:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ fs/nilfs2/recovery.c:409:9: note: Taking false branch ent = list_first_entry(head, struct nilfs_segment_entry, list); ^ include/linux/list.h:522:2: note: expanded from macro 'list_first_entry' list_entry((ptr)->next, type, member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ fs/nilfs2/recovery.c:409:9: note: Loop condition is false. Exiting loop ent = list_first_entry(head, struct nilfs_segment_entry, list); ^ include/linux/list.h:522:2: note: expanded from macro 'list_first_entry' list_entry((ptr)->next, type, member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert' do { \ ^ fs/nilfs2/recovery.c:410:3: note: Calling 'list_del' list_del(&ent->list); ^~~~~~~~~~~~~~~~~~~~ include/linux/list.h:146:2: note: Calling '__list_del_entry' __list_del_entry(entry); ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/list.h:132:2: note: Taking false branch if (!__list_del_entry_valid(entry)) ^ include/linux/list.h:135:13: note: Use of memory after it is freed __list_del(entry->prev, entry->next); ^~~~~~~~~~~ 1 warning generated. Suppressed 1 warnings (1 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. 1 warning generated. >> drivers/clk/at91/clk-master.c:197:7: warning: Division by zero >> [clang-analyzer-core.DivideZero] rate /= characteristics->divisors[div_index]; ^ drivers/clk/at91/clk-master.c:260:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(master_div->lock, flags); ^ include/linux/spinlock.h:393:2: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^ include/linux/spinlock.h:278:3: note: expanded from macro 'raw_spin_lock_irqsave' _raw_spin_lock_irqsave(lock, flags); \ ^ include/linux/spinlock_api_up.h:68:45: note: expanded from macro '_raw_spin_lock_irqsave' #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) ^ include/linux/spinlock_api_up.h:40:8: note: expanded from macro '__LOCK_IRQSAVE' do { local_irq_save(flags); __LOCK(lock); } while (0) ^ include/linux/irqflags.h:237:36: note: expanded from macro 'local_irq_save' #define local_irq_save(flags) do { raw_local_irq_save(flags); } while (0) ^ include/linux/irqflags.h:169:2: note: expanded from macro 'raw_local_irq_save' do { \ ^ drivers/clk/at91/clk-master.c:260:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(master_div->lock, flags); ^ include/linux/spinlock.h:393:2: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^ include/linux/spinlock.h:278:3: note: expanded from macro 'raw_spin_lock_irqsave' _raw_spin_lock_irqsave(lock, flags); \ ^ include/linux/spinlock_api_up.h:68:45: note: expanded from macro '_raw_spin_lock_irqsave' #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) ^ include/linux/spinlock_api_up.h:40:8: note: expanded from macro '__LOCK_IRQSAVE' do { local_irq_save(flags); __LOCK(lock); } while (0) ^ include/linux/irqflags.h:237:31: note: expanded from macro 'local_irq_save' #define local_irq_save(flags) do { raw_local_irq_save(flags); } while (0) ^ drivers/clk/at91/clk-master.c:260:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(master_div->lock, flags); ^ include/linux/spinlock.h:393:2: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^ include/linux/spinlock.h:278:3: note: expanded from macro 'raw_spin_lock_irqsave' _raw_spin_lock_irqsave(lock, flags); \ ^ include/linux/spinlock_api_up.h:68:45: note: expanded from macro '_raw_spin_lock_irqsave' #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) ^ include/linux/spinlock_api_up.h:40:31: note: expanded from macro '__LOCK_IRQSAVE' do { local_irq_save(flags); __LOCK(lock); } while (0) ^ include/linux/spinlock_api_up.h:31:27: note: expanded from macro '__LOCK' do { preempt_disable(); ___LOCK(lock); } while (0) ^ include/linux/spinlock_api_up.h:28:3: note: expanded from macro '___LOCK' do { __acquire(lock); (void)(lock); } while (0) ^ drivers/clk/at91/clk-master.c:260:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(master_div->lock, flags); ^ include/linux/spinlock.h:393:2: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^ include/linux/spinlock.h:278:3: note: expanded from macro 'raw_spin_lock_irqsave' _raw_spin_lock_irqsave(lock, flags); \ ^ include/linux/spinlock_api_up.h:68:45: note: expanded from macro '_raw_spin_lock_irqsave' #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) ^ include/linux/spinlock_api_up.h:40:31: note: expanded from macro '__LOCK_IRQSAVE' do { local_irq_save(flags); __LOCK(lock); } while (0) ^ include/linux/spinlock_api_up.h:31:3: note: expanded from macro '__LOCK' do { preempt_disable(); ___LOCK(lock); } while (0) ^ drivers/clk/at91/clk-master.c:260:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(master_div->lock, flags); ^ include/linux/spinlock.h:393:2: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^ include/linux/spinlock.h:278:3: note: expanded from macro 'raw_spin_lock_irqsave' _raw_spin_lock_irqsave(lock, flags); \ ^ include/linux/spinlock_api_up.h:68:45: note: expanded from macro '_raw_spin_lock_irqsave' #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) ^ include/linux/spinlock_api_up.h:40:3: note: expanded from macro '__LOCK_IRQSAVE' do { local_irq_save(flags); __LOCK(lock); } while (0) ^ drivers/clk/at91/clk-master.c:260:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(master_div->lock, flags); ^ include/linux/spinlock.h:393:2: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ vim +197 drivers/clk/at91/clk-master.c 7a110b9107ed8f Claudiu Beznea 2020-11-19 160 7029db09b2025f Claudiu Beznea 2021-10-11 161 /* This function must be called with lock acquired. */ 7029db09b2025f Claudiu Beznea 2021-10-11 162 static int clk_master_div_set(struct clk_master *master, 7029db09b2025f Claudiu Beznea 2021-10-11 163 unsigned long parent_rate, int div) 7a110b9107ed8f Claudiu Beznea 2020-11-19 164 { 7a110b9107ed8f Claudiu Beznea 2020-11-19 165 const struct clk_master_characteristics *characteristics = 7a110b9107ed8f Claudiu Beznea 2020-11-19 166 master->characteristics; 7029db09b2025f Claudiu Beznea 2021-10-11 167 unsigned long rate = parent_rate; 7029db09b2025f Claudiu Beznea 2021-10-11 168 unsigned int max_div = 0, div_index = 0, max_div_index = 0; 7029db09b2025f Claudiu Beznea 2021-10-11 169 unsigned int i, mckr, tmp; 36971566ea7a51 Claudiu Beznea 2021-10-11 170 int ret; 7a110b9107ed8f Claudiu Beznea 2020-11-19 171 7a110b9107ed8f Claudiu Beznea 2020-11-19 172 for (i = 0; i < ARRAY_SIZE(characteristics->divisors); i++) { 7a110b9107ed8f Claudiu Beznea 2020-11-19 173 if (!characteristics->divisors[i]) 7a110b9107ed8f Claudiu Beznea 2020-11-19 174 break; 7a110b9107ed8f Claudiu Beznea 2020-11-19 175 7029db09b2025f Claudiu Beznea 2021-10-11 176 if (div == characteristics->divisors[i]) 7029db09b2025f Claudiu Beznea 2021-10-11 177 div_index = i; 7029db09b2025f Claudiu Beznea 2021-10-11 178 7029db09b2025f Claudiu Beznea 2021-10-11 179 if (max_div < characteristics->divisors[i]) { 7029db09b2025f Claudiu Beznea 2021-10-11 180 max_div = characteristics->divisors[i]; 7029db09b2025f Claudiu Beznea 2021-10-11 181 max_div_index = i; 7a110b9107ed8f Claudiu Beznea 2020-11-19 182 } 7a110b9107ed8f Claudiu Beznea 2020-11-19 183 } 7a110b9107ed8f Claudiu Beznea 2020-11-19 184 7029db09b2025f Claudiu Beznea 2021-10-11 185 if (div > max_div) 7029db09b2025f Claudiu Beznea 2021-10-11 186 div_index = max_div_index; 7a110b9107ed8f Claudiu Beznea 2020-11-19 187 36971566ea7a51 Claudiu Beznea 2021-10-11 188 ret = regmap_read(master->regmap, master->layout->offset, &mckr); 36971566ea7a51 Claudiu Beznea 2021-10-11 189 if (ret) 7029db09b2025f Claudiu Beznea 2021-10-11 190 return ret; 36971566ea7a51 Claudiu Beznea 2021-10-11 191 a27748adeacab6 Claudiu Beznea 2021-10-11 192 mckr &= master->layout->mask; a27748adeacab6 Claudiu Beznea 2021-10-11 193 tmp = (mckr >> MASTER_DIV_SHIFT) & MASTER_DIV_MASK; 7029db09b2025f Claudiu Beznea 2021-10-11 194 if (tmp == div_index) 7029db09b2025f Claudiu Beznea 2021-10-11 195 return 0; 7029db09b2025f Claudiu Beznea 2021-10-11 196 7029db09b2025f Claudiu Beznea 2021-10-11 @197 rate /= characteristics->divisors[div_index]; 7029db09b2025f Claudiu Beznea 2021-10-11 198 if (rate < characteristics->output.min) 7029db09b2025f Claudiu Beznea 2021-10-11 199 pr_warn("master clk div is underclocked"); 7029db09b2025f Claudiu Beznea 2021-10-11 200 else if (rate > characteristics->output.max) 7029db09b2025f Claudiu Beznea 2021-10-11 201 pr_warn("master clk div is overclocked"); 36971566ea7a51 Claudiu Beznea 2021-10-11 202 36971566ea7a51 Claudiu Beznea 2021-10-11 203 mckr &= ~(MASTER_DIV_MASK << MASTER_DIV_SHIFT); 7029db09b2025f Claudiu Beznea 2021-10-11 204 mckr |= (div_index << MASTER_DIV_SHIFT); 36971566ea7a51 Claudiu Beznea 2021-10-11 205 ret = regmap_write(master->regmap, master->layout->offset, mckr); 36971566ea7a51 Claudiu Beznea 2021-10-11 206 if (ret) 7029db09b2025f Claudiu Beznea 2021-10-11 207 return ret; 36971566ea7a51 Claudiu Beznea 2021-10-11 208 7a110b9107ed8f Claudiu Beznea 2020-11-19 209 while (!clk_master_ready(master)) 7a110b9107ed8f Claudiu Beznea 2020-11-19 210 cpu_relax(); 7029db09b2025f Claudiu Beznea 2021-10-11 211 7029db09b2025f Claudiu Beznea 2021-10-11 212 master->div = characteristics->divisors[div_index]; 7a110b9107ed8f Claudiu Beznea 2020-11-19 213 7a110b9107ed8f Claudiu Beznea 2020-11-19 214 return 0; 7a110b9107ed8f Claudiu Beznea 2020-11-19 215 } 7a110b9107ed8f Claudiu Beznea 2020-11-19 216 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
