ALSA: ctxfi - Fix uninitialized error checks
authorTakashi Iwai <tiwai@suse.de>
Wed, 22 Jul 2009 15:05:15 +0000 (17:05 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 22 Jul 2009 15:05:15 +0000 (17:05 +0200)
Fix a few uninitialized error checks that were introduced recently
mistakenlly during the clean-up:
  sound/pci/ctxfi/ctamixer.c: In function ‘get_amixer_rsc’:
  sound/pci/ctxfi/ctamixer.c:261: warning: ‘err’ may be used uninitialized in this function
  sound/pci/ctxfi/ctamixer.c: In function ‘get_sum_rsc’:
  sound/pci/ctxfi/ctamixer.c:415: warning: ‘err’ may be used uninitialized in this function
  sound/pci/ctxfi/ctsrc.c: In function ‘get_srcimp_rsc’:
  sound/pci/ctxfi/ctsrc.c:742: warning: ‘err’ may be used uninitialized in this function

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/ctxfi/ctamixer.c
sound/pci/ctxfi/ctsrc.c

index a1db51b..a7f4a67 100644 (file)
@@ -242,13 +242,12 @@ static int get_amixer_rsc(struct amixer_mgr *mgr,
 
        /* Allocate mem for amixer resource */
        amixer = kzalloc(sizeof(*amixer), GFP_KERNEL);
-       if (NULL == amixer) {
-               err = -ENOMEM;
-               return err;
-       }
+       if (!amixer)
+               return -ENOMEM;
 
        /* Check whether there are sufficient
         * amixer resources to meet request. */
+       err = 0;
        spin_lock_irqsave(&mgr->mgr_lock, flags);
        for (i = 0; i < desc->msr; i++) {
                err = mgr_get_resource(&mgr->mgr, 1, &idx);
@@ -397,12 +396,11 @@ static int get_sum_rsc(struct sum_mgr *mgr,
 
        /* Allocate mem for sum resource */
        sum = kzalloc(sizeof(*sum), GFP_KERNEL);
-       if (NULL == sum) {
-               err = -ENOMEM;
-               return err;
-       }
+       if (!sum)
+               return -ENOMEM;
 
        /* Check whether there are sufficient sum resources to meet request. */
+       err = 0;
        spin_lock_irqsave(&mgr->mgr_lock, flags);
        for (i = 0; i < desc->msr; i++) {
                err = mgr_get_resource(&mgr->mgr, 1, &idx);
index e1c145d..df43a5c 100644 (file)
@@ -724,12 +724,11 @@ static int get_srcimp_rsc(struct srcimp_mgr *mgr,
 
        /* Allocate mem for SRCIMP resource */
        srcimp = kzalloc(sizeof(*srcimp), GFP_KERNEL);
-       if (NULL == srcimp) {
-               err = -ENOMEM;
-               return err;
-       }
+       if (!srcimp)
+               return -ENOMEM;
 
        /* Check whether there are sufficient SRCIMP resources. */
+       err = 0;
        spin_lock_irqsave(&mgr->mgr_lock, flags);
        for (i = 0; i < desc->msr; i++) {
                err = mgr_get_resource(&mgr->mgr, 1, &idx);