mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [2.6 patch] sound/core/control.c: remove dead code
@ 2006-11-06 18:30 Adrian Bunk
  2006-11-07 10:43 ` [Alsa-devel] " Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2006-11-06 18:30 UTC (permalink / raw)
  To: perex, alsa-devel; +Cc: linux-kernel

This patch removes some obviously dead code spotted by the Coverity 
checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- 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) {
 				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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Alsa-devel] [2.6 patch] sound/core/control.c: remove dead code
  2006-11-06 18:30 [2.6 patch] sound/core/control.c: remove dead code Adrian Bunk
@ 2006-11-07 10:43 ` Takashi Iwai
  2006-11-07 12:38   ` Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2006-11-07 10:43 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: perex, alsa-devel, linux-kernel

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 <bunk@stusta.de>

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) {
>  				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;
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Alsa-devel] [2.6 patch] sound/core/control.c: remove dead code
  2006-11-07 10:43 ` [Alsa-devel] " Takashi Iwai
@ 2006-11-07 12:38   ` Adrian Bunk
  2006-11-07 12:45     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2006-11-07 12:38 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: perex, alsa-devel, linux-kernel

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 <bunk@stusta.de>
> 
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Alsa-devel] [2.6 patch] sound/core/control.c: remove dead code
  2006-11-07 12:38   ` Adrian Bunk
@ 2006-11-07 12:45     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2006-11-07 12:45 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: alsa-devel, linux-kernel, perex

At Tue, 7 Nov 2006 13:38:06 +0100,
Adrian Bunk wrote:
> 
> 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 <bunk@stusta.de>
> > 
> > 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.

Ah, I see.  Now applied it to ALSA tree.

Thanks.

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-11-07 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-06 18:30 [2.6 patch] sound/core/control.c: remove dead code Adrian Bunk
2006-11-07 10:43 ` [Alsa-devel] " Takashi Iwai
2006-11-07 12:38   ` Adrian Bunk
2006-11-07 12:45     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®