Re: [linux-usb-devel] [PATCH] visor: Fix Oops on disconnect

nardelli
2004-05-25T18:55:42Z

Greg KH wrote:
> On Mon, May 24, 2004 at 05:42:54PM -0400, nardelli wrote:
>
>
> Nah, this is good enough. I've tweaked the patch a bit to keep from
> creating a big structure on the stack, and reduced the copy port logic
> to something a bit more readable and applied this version. I'll send it
> off to Linus in a day or so.
>
> Thanks a lot for your work on this.
>
> greg k-h
>
> +#define COPY_PORT(dest, src) \
> + dest->read_urb = src->read_urb; \
> + dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress; \
> + dest->bulk_in_buffer = src->bulk_in_buffer; \
> + dest->interrupt_in_urb = src->interrupt_in_urb; \
> + dest->interrupt_in_endpointAddress = src->interrupt_in_endpointAddress; \
> + dest->interrupt_in_buffer = src->interrupt_in_buffer;
> +
> + swap_port = kmalloc(sizeof(*swap_port), GFP_KERNEL);
> + if (!swap_port)
> + return -ENOMEM;
> + COPY_PORT(swap_port, serial->port[0]);
> + COPY_PORT(serial->port[0], serial->port[1]);
> + COPY_PORT(serial->port[1], swap_port);
> + kfree(swap_port);
>
> return 0;
> }
> -

That's definitely less error prone as well.

BTW - I appreciate the time that you have put into this, and especially
the constructive comments and patience that you had regarding patches
that I submitted.