[alsa-devel] [sound:topic/hda-ca0132-dsp 4/11] sound/pci/hda/patch_ca0132.c:714 dspio_send() warn: always true condition '(res >= 0) => (0-u32max >= 0)'

Dan Carpenter dan.carpenter at oracle.com
Mon Dec 17 18:35:43 CET 2012


Hi Ian,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git topic/hda-ca0132-dsp
head:   cdc83c59e59d57b250be46c4b9d31e3b2b5ae589
commit: 01ef7dbffb411d9d78d1150b268d9c757f9f2f93 [4/11] ALSA: hda - Update CA0132 codec to load DSP firmware binary

+ sound/pci/hda/patch_ca0132.c:714 dspio_send() warn: always true condition '(res >= 0) => (0-u32max >= 0)'
  sound/pci/hda/patch_ca0132.c:1781 dspxfr_one_seg() info: why not propagate 'status' from dsp_dma_stop() instead of (-5)?
  sound/pci/hda/patch_ca0132.c:1950 dspxfr_image() error: potential null dereference 'dma_engine'.  (kzalloc returns null)
  sound/pci/hda/patch_ca0132.c:1950 dspxfr_image() error: we previously assumed 'dma_engine' could be null (see line 1857)

git remote add sound git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
git remote update sound
git checkout 01ef7dbffb411d9d78d1150b268d9c757f9f2f93
vim +714 sound/pci/hda/patch_ca0132.c

01ef7dbf Ian Minett 2012-09-20  698  			    VENDOR_CHIPIO_PLL_PMU_WRITE, 0xff);
01ef7dbf Ian Minett 2012-09-20  699  	mutex_unlock(&spec->chipio_mutex);
01ef7dbf Ian Minett 2012-09-20  700  }
01ef7dbf Ian Minett 2012-09-20  701  
01ef7dbf Ian Minett 2012-09-20  702  /*
01ef7dbf Ian Minett 2012-09-20  703   * CA0132 DSP IO stuffs
01ef7dbf Ian Minett 2012-09-20  704   */
01ef7dbf Ian Minett 2012-09-20  705  static int dspio_send(struct hda_codec *codec, unsigned int reg,
01ef7dbf Ian Minett 2012-09-20  706  		      unsigned int data)
01ef7dbf Ian Minett 2012-09-20  707  {
01ef7dbf Ian Minett 2012-09-20  708  	unsigned int res;
01ef7dbf Ian Minett 2012-09-20  709  	int retry = 50;
01ef7dbf Ian Minett 2012-09-20  710  
01ef7dbf Ian Minett 2012-09-20  711  	/* send bits of data specified by reg to dsp */
01ef7dbf Ian Minett 2012-09-20  712  	do {
01ef7dbf Ian Minett 2012-09-20  713  		res = snd_hda_codec_read(codec, WIDGET_DSP_CTRL, 0, reg, data);
01ef7dbf Ian Minett 2012-09-20 @714  		if ((res >= 0) && (res != VENDOR_STATUS_DSPIO_BUSY))
01ef7dbf Ian Minett 2012-09-20  715  			return res;
01ef7dbf Ian Minett 2012-09-20  716  	} while (--retry);
01ef7dbf Ian Minett 2012-09-20  717  
01ef7dbf Ian Minett 2012-09-20  718  	return -EIO;
01ef7dbf Ian Minett 2012-09-20  719  }
01ef7dbf Ian Minett 2012-09-20  720  
01ef7dbf Ian Minett 2012-09-20  721  static void dspio_write_wait(struct hda_codec *codec)
01ef7dbf Ian Minett 2012-09-20  722  {

---
0-DAY kernel build testing backend         Open Source Technology Center
Fengguang Wu, Yuanhan Liu                              Intel Corporation


More information about the Alsa-devel mailing list