From patchwork Mon Mar 21 18:33:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Mickler X-Patchwork-Id: 648541 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2LIZ7IK013729 for ; Mon, 21 Mar 2011 18:35:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754307Ab1CUSef (ORCPT ); Mon, 21 Mar 2011 14:34:35 -0400 Received: from ist.d-labs.de ([213.239.218.44]:43669 "EHLO mx01.d-labs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754218Ab1CUSeI (ORCPT ); Mon, 21 Mar 2011 14:34:08 -0400 Received: from schatten.dmk.lab (f053218247.adsl.alicedsl.de [78.53.218.247]) by mx01.d-labs.de (Postfix) with ESMTPSA id 0806B7F8C6; Mon, 21 Mar 2011 19:34:08 +0100 (CET) Received: by schatten.dmk.lab (Postfix, from userid 1000) id 671EBC5C076; Mon, 21 Mar 2011 19:34:07 +0100 (CET) From: Florian Mickler To: mchehab@infradead.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, js@linuxtv.org, tskd2@yahoo.co.jp, liplianin@me.by, g.marco@freenet.de, aet@rasterburn.org, pb@linuxtv.org, mkrufky@linuxtv.org, nick@nick-andrew.net, max@veneto.com, janne-dvb@grunau.be, Florian Mickler Subject: [PATCH 6/6] [media] opera1: get rid of on-stack dma buffer Date: Mon, 21 Mar 2011 19:33:46 +0100 Message-Id: <1300732426-18958-7-git-send-email-florian@mickler.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1300732426-18958-1-git-send-email-florian@mickler.org> References: <1300732426-18958-1-git-send-email-florian@mickler.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 21 Mar 2011 18:35:09 +0000 (UTC) diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 1f1b7d6..2ca6e87 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c @@ -53,27 +53,36 @@ static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value, u8 * data, u16 len, int flags) { int ret; - u8 r; - u8 u8buf[len]; - + u8 tmp; + u8 *buf; unsigned int pipe = (flags == OPERA_READ_MSG) ? usb_rcvctrlpipe(dev,0) : usb_sndctrlpipe(dev, 0); u8 request_type = (flags == OPERA_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; + buf = kmalloc(len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + if (flags == OPERA_WRITE_MSG) - memcpy(u8buf, data, len); - ret = - usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR, - value, 0x0, u8buf, len, 2000); + memcpy(buf, data, len); + ret = usb_control_msg(dev, pipe, request, + request_type | USB_TYPE_VENDOR, value, 0x0, + buf, len, 2000); if (request == OPERA_TUNER_REQ) { + tmp = buf[0]; if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), - OPERA_TUNER_REQ, USB_DIR_IN | USB_TYPE_VENDOR, - 0x01, 0x0, &r, 1, 2000)<1 || r!=0x08) - return 0; + OPERA_TUNER_REQ, USB_DIR_IN | USB_TYPE_VENDOR, + 0x01, 0x0, buf, 1, 2000) < 1 || buf[0] != 0x08) { + ret = 0; + goto out; + } + buf[0] = tmp; } if (flags == OPERA_READ_MSG) - memcpy(data, u8buf, len); + memcpy(data, buf, len); +out: + kfree(buf); return ret; }