lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202104081510.kEbFg0Uz-lkp@intel.com>
Date:   Thu, 8 Apr 2021 15:48:23 +0800
From:   kernel test robot <lkp@...el.com>
To:     Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
        linux-arm-msm@...r.kernel.org
Cc:     kbuild-all@...ts.01.org, hemantk@...eaurora.org,
        linux-kernel@...r.kernel.org, bbhatt@...eaurora.org,
        Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Subject: Re: [PATCH] bus: mhi: core: Fix shadow declarations

Hi Manivannan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.12-rc6 next-20210407]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Manivannan-Sadhasivam/bus-mhi-core-Fix-shadow-declarations/20210408-144747
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 454859c552da78b0f587205d308401922b56863e
config: i386-randconfig-s032-20210407 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-279-g6d5d9b42-dirty
        # https://github.com/0day-ci/linux/commit/cca6579a65f1295cba8d8e7f12162b6270f71449
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Manivannan-Sadhasivam/bus-mhi-core-Fix-shadow-declarations/20210408-144747
        git checkout cca6579a65f1295cba8d8e7f12162b6270f71449
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/bus/mhi/core/main.c:774:64: sparse: sparse: mixing different enum types:
>> drivers/bus/mhi/core/main.c:774:64: sparse:    unsigned int enum mhi_pm_state
>> drivers/bus/mhi/core/main.c:774:64: sparse:    unsigned int enum mhi_state

vim +774 drivers/bus/mhi/core/main.c

1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  707  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  708  int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl,
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  709  			     struct mhi_event *mhi_event,
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  710  			     u32 event_quota)
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  711  {
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  712  	struct mhi_tre *dev_rp, *local_rp;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  713  	struct mhi_ring *ev_ring = &mhi_event->ring;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  714  	struct mhi_event_ctxt *er_ctxt =
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  715  		&mhi_cntrl->mhi_ctxt->er_ctxt[mhi_event->er_index];
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  716  	struct mhi_chan *mhi_chan;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  717  	struct device *dev = &mhi_cntrl->mhi_dev->dev;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  718  	u32 chan;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  719  	int count = 0;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  720  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  721  	/*
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  722  	 * This is a quick check to avoid unnecessary event processing
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  723  	 * in case MHI is already in error state, but it's still possible
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  724  	 * to transition to error state while processing events
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  725  	 */
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  726  	if (unlikely(MHI_EVENT_ACCESS_INVALID(mhi_cntrl->pm_state)))
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  727  		return -EIO;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  728  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  729  	dev_rp = mhi_to_virtual(ev_ring, er_ctxt->rp);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  730  	local_rp = ev_ring->rp;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  731  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  732  	while (dev_rp != local_rp) {
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  733  		enum mhi_pkt_type type = MHI_TRE_GET_EV_TYPE(local_rp);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  734  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  735  		switch (type) {
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  736  		case MHI_PKT_TYPE_BW_REQ_EVENT:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  737  		{
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  738  			struct mhi_link_info *link_info;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  739  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  740  			link_info = &mhi_cntrl->mhi_link_info;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  741  			write_lock_irq(&mhi_cntrl->pm_lock);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  742  			link_info->target_link_speed =
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  743  				MHI_TRE_GET_EV_LINKSPEED(local_rp);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  744  			link_info->target_link_width =
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  745  				MHI_TRE_GET_EV_LINKWIDTH(local_rp);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  746  			write_unlock_irq(&mhi_cntrl->pm_lock);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  747  			dev_dbg(dev, "Received BW_REQ event\n");
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  748  			mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_BW_REQ);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  749  			break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  750  		}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  751  		case MHI_PKT_TYPE_STATE_CHANGE_EVENT:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  752  		{
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  753  			enum mhi_state new_state;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  754  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  755  			new_state = MHI_TRE_GET_EV_STATE(local_rp);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  756  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  757  			dev_dbg(dev, "State change event to state: %s\n",
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  758  				TO_MHI_STATE_STR(new_state));
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  759  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  760  			switch (new_state) {
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  761  			case MHI_STATE_M0:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  762  				mhi_pm_m0_transition(mhi_cntrl);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  763  				break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  764  			case MHI_STATE_M1:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  765  				mhi_pm_m1_transition(mhi_cntrl);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  766  				break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  767  			case MHI_STATE_M3:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  768  				mhi_pm_m3_transition(mhi_cntrl);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  769  				break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  770  			case MHI_STATE_SYS_ERR:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  771  			{
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  772  				dev_dbg(dev, "System error detected\n");
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  773  				write_lock_irq(&mhi_cntrl->pm_lock);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20 @774  				new_state = mhi_tryset_pm_state(mhi_cntrl,
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  775  							MHI_PM_SYS_ERR_DETECT);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  776  				write_unlock_irq(&mhi_cntrl->pm_lock);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  777  				if (new_state == MHI_PM_SYS_ERR_DETECT)
bc7ccce5a5192c Hemant Kumar          2020-05-21  778  					mhi_pm_sys_err_handler(mhi_cntrl);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  779  				break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  780  			}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  781  			default:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  782  				dev_err(dev, "Invalid state: %s\n",
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  783  					TO_MHI_STATE_STR(new_state));
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  784  			}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  785  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  786  			break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  787  		}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  788  		case MHI_PKT_TYPE_CMD_COMPLETION_EVENT:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  789  			mhi_process_cmd_completion(mhi_cntrl, local_rp);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  790  			break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  791  		case MHI_PKT_TYPE_EE_EVENT:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  792  		{
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  793  			enum dev_st_transition st = DEV_ST_TRANSITION_MAX;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  794  			enum mhi_ee_type event = MHI_TRE_GET_EV_EXECENV(local_rp);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  795  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  796  			dev_dbg(dev, "Received EE event: %s\n",
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  797  				TO_MHI_EXEC_STR(event));
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  798  			switch (event) {
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  799  			case MHI_EE_SBL:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  800  				st = DEV_ST_TRANSITION_SBL;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  801  				break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  802  			case MHI_EE_WFW:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  803  			case MHI_EE_AMSS:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  804  				st = DEV_ST_TRANSITION_MISSION_MODE;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  805  				break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  806  			case MHI_EE_RDDM:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  807  				mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  808  				write_lock_irq(&mhi_cntrl->pm_lock);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  809  				mhi_cntrl->ee = event;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  810  				write_unlock_irq(&mhi_cntrl->pm_lock);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  811  				wake_up_all(&mhi_cntrl->state_event);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  812  				break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  813  			default:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  814  				dev_err(dev,
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  815  					"Unhandled EE event: 0x%x\n", type);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  816  			}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  817  			if (st != DEV_ST_TRANSITION_MAX)
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  818  				mhi_queue_state_transition(mhi_cntrl, st);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  819  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  820  			break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  821  		}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  822  		case MHI_PKT_TYPE_TX_EVENT:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  823  			chan = MHI_TRE_GET_EV_CHID(local_rp);
020960685041fc Hemant Kumar          2020-05-21  824  
020960685041fc Hemant Kumar          2020-05-21  825  			WARN_ON(chan >= mhi_cntrl->max_chan);
020960685041fc Hemant Kumar          2020-05-21  826  
020960685041fc Hemant Kumar          2020-05-21  827  			/*
020960685041fc Hemant Kumar          2020-05-21  828  			 * Only process the event ring elements whose channel
020960685041fc Hemant Kumar          2020-05-21  829  			 * ID is within the maximum supported range.
020960685041fc Hemant Kumar          2020-05-21  830  			 */
020960685041fc Hemant Kumar          2020-05-21  831  			if (chan < mhi_cntrl->max_chan) {
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  832  				mhi_chan = &mhi_cntrl->mhi_chan[chan];
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  833  				parse_xfer_event(mhi_cntrl, local_rp, mhi_chan);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  834  				event_quota--;
020960685041fc Hemant Kumar          2020-05-21  835  			}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  836  			break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  837  		default:
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  838  			dev_err(dev, "Unhandled event type: %d\n", type);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  839  			break;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  840  		}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  841  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  842  		mhi_recycle_ev_ring_element(mhi_cntrl, ev_ring);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  843  		local_rp = ev_ring->rp;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  844  		dev_rp = mhi_to_virtual(ev_ring, er_ctxt->rp);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  845  		count++;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  846  	}
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  847  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  848  	read_lock_bh(&mhi_cntrl->pm_lock);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  849  	if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl)))
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  850  		mhi_ring_er_db(mhi_event);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  851  	read_unlock_bh(&mhi_cntrl->pm_lock);
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  852  
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  853  	return count;
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  854  }
1d3173a3bae703 Manivannan Sadhasivam 2020-02-20  855  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (27672 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ