Re: [Alsa-devel] [2.6 patch] sound/core/control.c: remove dead code

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

 



On Tue, Nov 07, 2006 at 11:43:48AM +0100, Takashi Iwai wrote:
> At Mon, 6 Nov 2006 19:30:18 +0100,
> Adrian Bunk wrote:
> > 
> > This patch removes some obviously dead code spotted by the Coverity 
> > checker.
> > 
> > Signed-off-by: Adrian Bunk <[email protected]>
> 
> I think it's a wrong fix.  result could be > 0 indeed.
> 
> Takashi
> 
> > 
> > --- linux-2.6/sound/core/control.c.old	2006-11-06 19:11:32.000000000 +0100
> > +++ linux-2.6/sound/core/control.c	2006-11-06 19:11:52.000000000 +0100
> > @@ -1267,23 +1267,23 @@ static ssize_t snd_ctl_read(struct file 
> >  			if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) {

That is already checked here ->                                  ^^^^^^^^^^

And after this point, result is never assigned any value.

> >  				err = -EAGAIN;
> >  				goto __end_lock;
> >  			}
> >  			init_waitqueue_entry(&wait, current);
> >  			add_wait_queue(&ctl->change_sleep, &wait);
> >  			set_current_state(TASK_INTERRUPTIBLE);
> >  			spin_unlock_irq(&ctl->read_lock);
> >  			schedule();
> >  			remove_wait_queue(&ctl->change_sleep, &wait);
> >  			if (signal_pending(current))
> > -				return result > 0 ? result : -ERESTARTSYS;
> > +				return -ERESTARTSYS;
> >  			spin_lock_irq(&ctl->read_lock);
> >  		}
> >  		kev = snd_kctl_event(ctl->events.next);
> >  		ev.type = SNDRV_CTL_EVENT_ELEM;
> >  		ev.data.elem.mask = kev->mask;
> >  		ev.data.elem.id = kev->id;
> >  		list_del(&kev->list);
> >  		spin_unlock_irq(&ctl->read_lock);
> >  		kfree(kev);
> >  		if (copy_to_user(buffer, &ev, sizeof(struct snd_ctl_event))) {
> >  			err = -EFAULT;
> > 

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux