CC: [email protected]
TO: Scott Branden <[email protected]>
CC: "Greg Kroah-Hartman" <[email protected]>
CC: Desmond Yan <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 
char-misc-testing
head:   3a11b0b5d8d2b3f7d4b44945ef9226a3115bb15f
commit: 111d746bb4767ad476f80fe49067e3df3d9a9375 [33/75] misc: bcm-vk: add VK 
messaging support
:::::: branch date: 2 days ago
:::::: commit date: 11 days ago
config: powerpc-randconfig-m031-20210205 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/misc/bcm-vk/bcm_vk_msg.c:1255 bcm_vk_release() error: uninitialized 
symbol 'dma_cnt'.

vim +/dma_cnt +1255 drivers/misc/bcm-vk/bcm_vk_msg.c

111d746bb4767a Scott Branden 2021-01-20  1232  
22c30607d1e0c6 Scott Branden 2021-01-20  1233  int bcm_vk_release(struct inode 
*inode, struct file *p_file)
22c30607d1e0c6 Scott Branden 2021-01-20  1234  {
22c30607d1e0c6 Scott Branden 2021-01-20  1235   int ret;
22c30607d1e0c6 Scott Branden 2021-01-20  1236   struct bcm_vk_ctx *ctx = 
p_file->private_data;
22c30607d1e0c6 Scott Branden 2021-01-20  1237   struct bcm_vk *vk = 
container_of(ctx->miscdev, struct bcm_vk, miscdev);
111d746bb4767a Scott Branden 2021-01-20  1238   struct device *dev = 
&vk->pdev->dev;
111d746bb4767a Scott Branden 2021-01-20  1239   pid_t pid = ctx->pid;
111d746bb4767a Scott Branden 2021-01-20  1240   int dma_cnt;
111d746bb4767a Scott Branden 2021-01-20  1241   unsigned long timeout, 
start_time;
111d746bb4767a Scott Branden 2021-01-20  1242  
111d746bb4767a Scott Branden 2021-01-20  1243   /*
111d746bb4767a Scott Branden 2021-01-20  1244    * if there are outstanding DMA 
transactions, need to delay long enough
111d746bb4767a Scott Branden 2021-01-20  1245    * to ensure that the card side 
would have stopped touching the host buffer
111d746bb4767a Scott Branden 2021-01-20  1246    * and its SGL list.  A race 
condition could happen if the host app is killed
111d746bb4767a Scott Branden 2021-01-20  1247    * abruptly, eg kill -9, while 
some DMA transfer orders are still inflight.
111d746bb4767a Scott Branden 2021-01-20  1248    * Nothing could be done except 
for a delay as host side is running in a
111d746bb4767a Scott Branden 2021-01-20  1249    * completely async fashion.
111d746bb4767a Scott Branden 2021-01-20  1250    */
111d746bb4767a Scott Branden 2021-01-20  1251   start_time = jiffies;
111d746bb4767a Scott Branden 2021-01-20  1252   timeout = start_time + 
msecs_to_jiffies(BCM_VK_DMA_DRAIN_MAX_MS);
111d746bb4767a Scott Branden 2021-01-20  1253   do {
111d746bb4767a Scott Branden 2021-01-20  1254           if (time_after(jiffies, 
timeout)) {
111d746bb4767a Scott Branden 2021-01-20 @1255                   dev_warn(dev, 
"%d dma still pending for [fd-%d] pid %d\n",
111d746bb4767a Scott Branden 2021-01-20  1256                            
dma_cnt, ctx->idx, pid);
111d746bb4767a Scott Branden 2021-01-20  1257                   break;
111d746bb4767a Scott Branden 2021-01-20  1258           }
111d746bb4767a Scott Branden 2021-01-20  1259           dma_cnt = 
atomic_read(&ctx->dma_cnt);
111d746bb4767a Scott Branden 2021-01-20  1260           cpu_relax();
111d746bb4767a Scott Branden 2021-01-20  1261           cond_resched();
111d746bb4767a Scott Branden 2021-01-20  1262   } while (dma_cnt);
111d746bb4767a Scott Branden 2021-01-20  1263   dev_dbg(dev, "Draining for 
[fd-%d] pid %d - delay %d ms\n",
111d746bb4767a Scott Branden 2021-01-20  1264           ctx->idx, pid, 
jiffies_to_msecs(jiffies - start_time));
111d746bb4767a Scott Branden 2021-01-20  1265  
111d746bb4767a Scott Branden 2021-01-20  1266   
bcm_vk_drain_all_pend(&vk->pdev->dev, &vk->to_v_msg_chan, ctx);
111d746bb4767a Scott Branden 2021-01-20  1267   
bcm_vk_drain_all_pend(&vk->pdev->dev, &vk->to_h_msg_chan, ctx);
22c30607d1e0c6 Scott Branden 2021-01-20  1268  
22c30607d1e0c6 Scott Branden 2021-01-20  1269   ret = bcm_vk_free_ctx(vk, ctx);
111d746bb4767a Scott Branden 2021-01-20  1270   if (ret == 0)
111d746bb4767a Scott Branden 2021-01-20  1271           ret = 
bcm_vk_handle_last_sess(vk, pid, ctx->q_num);
111d746bb4767a Scott Branden 2021-01-20  1272   else
111d746bb4767a Scott Branden 2021-01-20  1273           ret = 0;
22c30607d1e0c6 Scott Branden 2021-01-20  1274  
22c30607d1e0c6 Scott Branden 2021-01-20  1275   kref_put(&vk->kref, 
bcm_vk_release_data);
22c30607d1e0c6 Scott Branden 2021-01-20  1276  
22c30607d1e0c6 Scott Branden 2021-01-20  1277   return ret;
22c30607d1e0c6 Scott Branden 2021-01-20  1278  }
22c30607d1e0c6 Scott Branden 2021-01-20  1279  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to