Re: [PATCH] ucsi_ccg: Refine the UCSI Interrupt handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Haotien,

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Haotien-Hsu/ucsi_ccg-Refine-the-UCSI-Interrupt-handling/20221221-163923
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20221221083812.3363045-1-haotienh%40nvidia.com
patch subject: [PATCH] ucsi_ccg: Refine the UCSI Interrupt handling
config: x86_64-randconfig-m001-20221226
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>

smatch warnings:
drivers/usb/typec/ucsi/ucsi_ccg.c:708 ccg_irq_handler() error: uninitialized symbol 'cci'.

vim +/cci +708 drivers/usb/typec/ucsi/ucsi_ccg.c

247c554a14aa16 Ajay Gupta      2018-10-26  675  static irqreturn_t ccg_irq_handler(int irq, void *data)
247c554a14aa16 Ajay Gupta      2018-10-26  676  {
e32fd989ac1c45 Heikki Krogerus 2019-11-04  677  	u16 reg = CCGX_RAB_UCSI_DATA_BLOCK(UCSI_CCI);
247c554a14aa16 Ajay Gupta      2018-10-26  678  	struct ucsi_ccg *uc = data;
e32fd989ac1c45 Heikki Krogerus 2019-11-04  679  	u8 intr_reg;
e32fd989ac1c45 Heikki Krogerus 2019-11-04  680  	u32 cci;
e32fd989ac1c45 Heikki Krogerus 2019-11-04  681  	int ret;
e32fd989ac1c45 Heikki Krogerus 2019-11-04  682  
e32fd989ac1c45 Heikki Krogerus 2019-11-04  683  	ret = ccg_read(uc, CCGX_RAB_INTR_REG, &intr_reg, sizeof(intr_reg));
e32fd989ac1c45 Heikki Krogerus 2019-11-04  684  	if (ret)
e32fd989ac1c45 Heikki Krogerus 2019-11-04  685  		return ret;
e32fd989ac1c45 Heikki Krogerus 2019-11-04  686  
e65232d7f1fccd Sing-Han Chen   2022-12-21  687  	if (!intr_reg)
e65232d7f1fccd Sing-Han Chen   2022-12-21  688  		return IRQ_HANDLED;
e65232d7f1fccd Sing-Han Chen   2022-12-21  689  	else if (!(intr_reg & UCSI_READ_INT))
e65232d7f1fccd Sing-Han Chen   2022-12-21  690  		goto err_clear_irq;

cci is uninitialized on this goto.

e65232d7f1fccd Sing-Han Chen   2022-12-21  691  
e32fd989ac1c45 Heikki Krogerus 2019-11-04  692  	ret = ccg_read(uc, reg, (void *)&cci, sizeof(cci));
e32fd989ac1c45 Heikki Krogerus 2019-11-04  693  	if (ret)
e32fd989ac1c45 Heikki Krogerus 2019-11-04  694  		goto err_clear_irq;
e32fd989ac1c45 Heikki Krogerus 2019-11-04  695  
e32fd989ac1c45 Heikki Krogerus 2019-11-04  696  	if (UCSI_CCI_CONNECTOR(cci))
e32fd989ac1c45 Heikki Krogerus 2019-11-04  697  		ucsi_connector_change(uc->ucsi, UCSI_CCI_CONNECTOR(cci));
247c554a14aa16 Ajay Gupta      2018-10-26  698  
e65232d7f1fccd Sing-Han Chen   2022-12-21  699  	/* As per CCGx UCSI interface guide, copy CCI and MESSAGE_IN
e65232d7f1fccd Sing-Han Chen   2022-12-21  700  	 * to the OpRegion before clear the UCSI interrupt
e65232d7f1fccd Sing-Han Chen   2022-12-21  701  	 */
e65232d7f1fccd Sing-Han Chen   2022-12-21  702  	ccg_op_region_update(uc, cci);
e32fd989ac1c45 Heikki Krogerus 2019-11-04  703  
e32fd989ac1c45 Heikki Krogerus 2019-11-04  704  err_clear_irq:
e32fd989ac1c45 Heikki Krogerus 2019-11-04  705  	ccg_write(uc, CCGX_RAB_INTR_REG, &intr_reg, sizeof(intr_reg));
247c554a14aa16 Ajay Gupta      2018-10-26  706  
e65232d7f1fccd Sing-Han Chen   2022-12-21  707  	if (!ret && test_bit(DEV_CMD_PENDING, &uc->flags) &&
e65232d7f1fccd Sing-Han Chen   2022-12-21 @708  	    cci & (UCSI_CCI_ACK_COMPLETE | UCSI_CCI_COMMAND_COMPLETE))
e65232d7f1fccd Sing-Han Chen   2022-12-21  709  		complete(&uc->complete);
e65232d7f1fccd Sing-Han Chen   2022-12-21  710  
247c554a14aa16 Ajay Gupta      2018-10-26  711  	return IRQ_HANDLED;
247c554a14aa16 Ajay Gupta      2018-10-26  712  }

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux