linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: tskd08@gmail.com
Cc: linux-media@vger.kernel.org, mchehab@s-opensource.com, crope@iki.fi
Subject: Re: [PATCH v5 5/5] dvb-usb-v2/gl861: ensure  USB message buffers DMA'able
Date: Sat, 5 May 2018 08:17:02 -0300	[thread overview]
Message-ID: <20180505081657.5e3c1cc2@vento.lan> (raw)
In-Reply-To: <20180408172138.9974-6-tskd08@gmail.com>

Em Mon,  9 Apr 2018 02:21:38 +0900
tskd08@gmail.com escreveu:

> From: Akihiro Tsukada <tskd08@gmail.com>
> 
> i2c message buf might be on stack.

That patch also applied without changes. So, just patch 3/5 was not applied.

> 
> Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
> ---
> Changes since v4:
> - none
> 
>  drivers/media/usb/dvb-usb-v2/gl861.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/usb/dvb-usb-v2/gl861.c b/drivers/media/usb/dvb-usb-v2/gl861.c
> index cdd7bfcb883..47b614da807 100644
> --- a/drivers/media/usb/dvb-usb-v2/gl861.c
> +++ b/drivers/media/usb/dvb-usb-v2/gl861.c
> @@ -22,6 +22,8 @@ static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
>  	u16 value = addr << (8 + 1);
>  	int wo = (rbuf == NULL || rlen == 0); /* write-only */
>  	u8 req, type;
> +	u8 *buf;
> +	int ret;
>  
>  	if (wo) {
>  		req = GL861_REQ_I2C_WRITE;
> @@ -44,11 +46,23 @@ static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
>  				KBUILD_MODNAME, wlen);
>  		return -EINVAL;
>  	}
> -
> +	buf = NULL;
> +	if (rlen > 0) {
> +		buf = kmalloc(rlen, GFP_KERNEL);
> +		if (!buf)
> +			return -ENOMEM;
> +	}
>  	usleep_range(1000, 2000); /* avoid I2C errors */
>  
> -	return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
> -			       value, index, rbuf, rlen, 2000);
> +	ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
> +			      value, index, buf, rlen, 2000);
> +	if (rlen > 0) {
> +		if (ret > 0)
> +			memcpy(rbuf, buf, rlen);
> +		kfree(buf);
> +	}
> +
> +	return ret;
>  }
>  
>  /* Friio specific I2C read/write */



Thanks,
Mauro

      reply	other threads:[~2018-05-05 11:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08 17:21 [PATCH v5 0/5] dvb-usb-friio: decompose friio and merge with gl861 tskd08
2018-04-08 17:21 ` [PATCH v5 1/5] dvb-frontends/dvb-pll: add i2c driver support tskd08
2018-04-08 17:21 ` [PATCH v5 2/5] dvb-frontends/dvb-pll: add tua6034 ISDB-T tuner used in Friio tskd08
2018-04-08 17:21 ` [PATCH v6 3/5] dvb-usb/friio, dvb-usb-v2/gl861: decompose friio and merge with gl861 tskd08
2018-05-05 11:12   ` Mauro Carvalho Chehab
2018-05-13 18:13     ` Akihiro TSUKADA
2018-05-13 19:25       ` Mauro Carvalho Chehab
2018-04-08 17:21 ` [PATCH v5 4/5] dvb-usb-v2/gl861: use usleep_range() for short delay tskd08
2018-05-05 11:14   ` Mauro Carvalho Chehab
2018-04-08 17:21 ` [PATCH v5 5/5] dvb-usb-v2/gl861: ensure USB message buffers DMA'able tskd08
2018-05-05 11:17   ` Mauro Carvalho Chehab [this message]

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=20180505081657.5e3c1cc2@vento.lan \
    --to=mchehab+samsung@kernel.org \
    --cc=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@s-opensource.com \
    --cc=tskd08@gmail.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;
as well as URLs for NNTP newsgroup(s).