public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Dean A." <dean@sensoray.com>
To: linux-media@vger.kernel.org, video4linux-list@redhat.com,
	mchehab@infradead.org
Subject: patch: s2255drv: urb completion routine fixes
Date: Thu, 30 Apr 2009 08:29:38 -0700 (PDT)	[thread overview]
Message-ID: <tkrat.5b56fa3a69c1e6ea@sensoray.com> (raw)

From: Dean Anderson <dean@sensoray.com>

Error count in read pipe completion corrected.
URB not resubmitted if shutting down.
URB not freed in completion routine if new urb_submit_fails.
(URB is freed on shutdown).

Signed-off-by: Dean Anderson <dean@sensoray.com>

--- v4l-dvb-83712d149893/linux/drivers/media/video/s2255drv.c.orig	2009-04-30 07:34:34.000000000 -0700
+++ v4l-dvb-83712d149893/linux/drivers/media/video/s2255drv.c	2009-04-30 07:27:10.000000000 -0700
@@ -2240,8 +2240,10 @@ static void read_pipe_completion(struct 
 		return;
 	}
 	status = purb->status;
-	if (status != 0) {
-		dprintk(2, "read_pipe_completion: err\n");
+	/* if shutting down, do not resubmit, exit immediately */
+	if (status == -ESHUTDOWN) {
+		dprintk(2, "read_pipe_completion: err shutdown\n");
+		pipe_info->err_count++;
 		return;
 	}
 
@@ -2250,9 +2252,13 @@ static void read_pipe_completion(struct 
 		return;
 	}
 
-	s2255_read_video_callback(dev, pipe_info);
+	if (status == 0)
+		s2255_read_video_callback(dev, pipe_info);
+	else {
+		pipe_info->err_count++;
+		dprintk(1, "s2255drv: failed URB %d\n", status);
+	}
 
-	pipe_info->err_count = 0;
 	pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint);
 	/* reuse urb */
 	usb_fill_bulk_urb(pipe_info->stream_urb, dev->udev,
@@ -2264,7 +2270,6 @@ static void read_pipe_completion(struct 
 	if (pipe_info->state != 0) {
 		if (usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL)) {
 			dev_err(&dev->udev->dev, "error submitting urb\n");
-			usb_free_urb(pipe_info->stream_urb);
 		}
 	} else {
 		dprintk(2, "read pipe complete state 0\n");


                 reply	other threads:[~2009-04-30 15:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tkrat.5b56fa3a69c1e6ea@sensoray.com \
    --to=dean@sensoray.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox