All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: [PATCH 2/3] [media] gp8psk: fix gp8psk_usb_in_op() logic
Date: Sat, 12 Nov 2016 12:46:27 -0200	[thread overview]
Message-ID: <63f2a40077c69be7a37f8b1918c9cdccf429d353.1478960480.git.mchehab@osg.samsung.com> (raw)
In-Reply-To: <cover.1478960480.git.mchehab@osg.samsung.com>
In-Reply-To: <cover.1478960480.git.mchehab@osg.samsung.com>

From: Mauro Carvalho Chehab <mchehab@s-opensource.com>

Changeset bc29131ecb10 ("[media] gp8psk: don't do DMA on stack")
fixed the usage of DMA on stack, but the memcpy was wrong
for gp8psk_usb_in_op(). Fix it.

>From Derek's email:
	"Fix confirmed using 2 different Skywalker models with
	 HD mpeg4, SD mpeg2."

Suggested-by: Johannes Stezenbach <js@linuxtv.org>
Fixes: bc29131ecb10 ("[media] gp8psk: don't do DMA on stack")
Tested-by: Derek <user.vdr@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/usb/dvb-usb/gp8psk.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c
index adfd76491451..2829e3082d15 100644
--- a/drivers/media/usb/dvb-usb/gp8psk.c
+++ b/drivers/media/usb/dvb-usb/gp8psk.c
@@ -67,7 +67,6 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8
 		return ret;
 
 	while (ret >= 0 && ret != blen && try < 3) {
-		memcpy(st->data, b, blen);
 		ret = usb_control_msg(d->udev,
 			usb_rcvctrlpipe(d->udev,0),
 			req,
@@ -81,8 +80,10 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8
 	if (ret < 0 || ret != blen) {
 		warn("usb in %d operation failed.", req);
 		ret = -EIO;
-	} else
+	} else {
 		ret = 0;
+		memcpy(b, st->data, blen);
+	}
 
 	deb_xfer("in: req. %x, val: %x, ind: %x, buffer: ",req,value,index);
 	debug_dump(b,blen,deb_xfer);
-- 
2.9.3


  parent reply	other threads:[~2016-11-12 14:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12 14:46 [PATCH 0/3] Media fixes for Kernel 4.9-rc5 Mauro Carvalho Chehab
2016-11-12 14:46 ` [PATCH 1/3] [media] dvb-usb: move data_mutex to struct dvb_usb_device Mauro Carvalho Chehab
2016-11-14 12:57   ` Michael Ira Krufky
2016-11-12 14:46 ` Mauro Carvalho Chehab [this message]
2016-11-12 14:46 ` [PATCH 3/3] [media] gp8psk: Fix DVB frontend attach Mauro Carvalho Chehab

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=63f2a40077c69be7a37f8b1918c9cdccf429d353.1478960480.git.mchehab@osg.samsung.com \
    --to=mchehab@osg.samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=mchehab@kernel.org \
    --cc=mchehab@s-opensource.com \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.