All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: Malcolm Priestley <tvboxspy@gmail.com>
Cc: linux-media <linux-media@vger.kernel.org>
Subject: Re: dvb_usb_v2: use pointers to properties[REGRESSION]
Date: Sat, 16 Jun 2012 23:27:11 +0300	[thread overview]
Message-ID: <4FDCEC1F.2080008@iki.fi> (raw)
In-Reply-To: <1339877826.2697.4.camel@Route3278>

On 06/16/2012 11:17 PM, Malcolm Priestley wrote:
> On Sat, 2012-06-16 at 21:41 +0300, Antti Palosaari wrote:
>
>>
>> That is what you want to do:
>> ****************************
>> CALLBACK(struct dvb_usb_adapter *adap)
>> {
>>     struct dvb_frontend *fe = adap->fe[adap->active_fe];
>>     // now we have pointer to adap and fe
>> }
>>
>> That is what I want to do:
>> **************************
>> CALLBACK(struct dvb_frontend *fe)
>> {
>>     struct dvb_usb_adapter *adap = fe->dvb->priv;
>>     // now we have pointer to adap and fe
>> }
> I just don't like the idea of deliberately sending a NULL object to
> a callback.

Same here, I mentioned that many times I will fix it. And it is now 
fixed, just fetch latest changes.

>
>
> Ha ... I know what is causing the crash....its in usb_urb.c
>
>
> int usb_urb_init(struct usb_data_stream *stream,
> 		struct usb_data_stream_properties *props)
> {
> 	int ret;
>
> 	if (stream == NULL || props == NULL)
> 		return -EINVAL;
>
> 	memcpy(&stream->props, props, sizeof(*props));
>
> 	usb_clear_halt(stream->udev, usb_rcvbulkpipe(stream->udev,
> 			stream->props.endpoint));
>
> The usb_clear_halt with 0 endpoint.
>
> It can tweaked by sending a valid endpoint.

Aaah, that explains. Anyhow, I am almost sure usb_clear_halt() will not 
crash but return error in worst case. You are likely using that endpoint 
in your driver elsewhere and it is crashing as next operation to 
endpoint fails. Error in some USB control routines of your driver? It 
could be also error handling error in dvb usb routines, the idea is to 
stop device registration and un-register all if there is error. But I 
haven't tested all the error branches.

Anyhow, check recent patches and I think you are happy.

regards
Antti

-- 
http://palosaari.fi/



      reply	other threads:[~2012-06-16 20:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 22:11 dvb_usb_v2: use pointers to properties[REGRESSION] Malcolm Priestley
2012-06-15 22:54 ` Antti Palosaari
2012-06-16  0:35   ` Malcolm Priestley
2012-06-16  0:55     ` Antti Palosaari
2012-06-16  1:16       ` Antti Palosaari
2012-06-16 12:06         ` Malcolm Priestley
2012-06-16 15:52           ` Antti Palosaari
2012-06-16 18:12             ` Malcolm Priestley
2012-06-16 18:41               ` Antti Palosaari
2012-06-16 20:17                 ` Malcolm Priestley
2012-06-16 20:27                   ` Antti Palosaari [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=4FDCEC1F.2080008@iki.fi \
    --to=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    --cc=tvboxspy@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 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.