Re: [PATCH] Fix Trivial Warnining in sound/pci/cmipci.c

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

 



On Mon, 2009-04-27 at 13:54 +0200, Takashi Iwai wrote:
> At Mon, 27 Apr 2009 16:42:37 +0530,
> Subrata Modak wrote:
> > 
> > To: Takashi Iwai <tiwai@xxxxxxx>
> > Cc: Sachin P Sant <sachinp@xxxxxxxxxxxxxxxxxx>, Subrata Modak <subrata@xxxxxxxxxxxxxxxxxx>,
> >  Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx>, linux-pci <linux-pci@xxxxxxxxxxxxxxxxxxxxxxxx>
> > Subject: [PATCH] Fix Trivial Warnining in sound/pci/cmipci.c
> > From: Subrata Modak <subrata@xxxxxxxxxxxxxxxxxx>
> > Date: Mon, 27 Apr 2009 16:42:37 +0530
> > Message-Id: <20090427111237.8838.35630.sendpatchset@xxxxxxxxxxxxxxxxxxxxxxxxxx>
> > 
> > Hi Takashi,
> > 
> > I observed the following build warning:
> > ---
> > sound/pci/cmipci.c: In function ‘snd_cmipci_probe’:
> > sound/pci/cmipci.c:3017: warning: ‘iomidi’ may be used uninitialized in this function
> > ---
> > 
> > On investigation i found that ‘iomidi’ is getting conditional initialization
> > at the following lines of code.
> > 
> > 3165         if (cm->chip_version >= 39) {
> > 3166                 val = snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1);
> > 3167                 if (val != 0x00 && val != 0xff) {
> > 3168                         iomidi = cm->iobase + CM_REG_MPU_PCI;
> > 3169                         integrated_midi = 1;
> > 3170                 }
> > 3171         }
> > 3172         if (!integrated_midi) {
> > 3173                 val = 0;
> > 3174                 iomidi = mpu_port[dev];
> > 3175                 switch (iomidi) {
> > 3176                 case 0x320: val = CM_VMPU_320; break;
> > 3177                 case 0x310: val = CM_VMPU_310; break;
> > 3178                 case 0x300: val = CM_VMPU_300; break;
> > 3179                 case 0x330: val = CM_VMPU_330; break;
> > 3180                 default:
> > 3181                             iomidi = 0; break;
> > 3182                 }
> > 3183                 if (iomidi > 0) {
> > 3184                         snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val);
> > 3185                         /* enable UART */
> > 3186                         snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_UART_EN);
> > 3187                         if (inb(iomidi + 1) == 0xff) {
> > 3188                                 snd_printk(KERN_ERR "cannot enable MPU-401 port"
> > 3189                                            " at %#lx\n", iomidi);
> > 3190                                 snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1,
> > 3191                                                      CM_UART_EN);
> > 3192                                 iomidi = 0;
> > 3193                         }
> > 3194                 }
> > 3195         }
> > 
> > However, if the above conditional initialization does not take place,
> > then the following comparisn statment can create problem. I am proposing a
> > trivial fix for this scenario. Please accept if you like it.
> 
> Thanks, the patch looks good.
> Now applied to sound git tree.
> 

Thanks.

Regards--
Subrata

> 
> Takashi

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux