> > - /* allocate kernel memory */
> > - mem_failure = 0;
> > - if (!(ir = kmalloc(sizeof(struct irctl), GFP_KERNEL))) {
> > - mem_failure = 1;
> > - } else {
> > - memset(ir, 0, sizeof(struct irctl));
> > -
> > - if (!(plugin = kmalloc(sizeof(struct lirc_plugin), GFP_KERNEL))) {
> > - mem_failure = 2;
> > - } else if (!(rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL))) {
> > - mem_failure = 3;
>
> If size of all structs, allocated here is 3-4 pages (say, 4096 bytes
> one), then, i think something like, allocating all at once may be
> utilized:
>
> ,-*-
> |struct ir_stuff_t {
> | struct irctl *ir;
> | struct lirc_plugin *plugin;
> | struct lirc_buffer *rbuf;
I guess you mean
struct lirc_buffer rbuf;
without the "*"
> |} ir_stuff;
> |
> |ir_stuff = kzalloc(...);
> |
> |if(!ir_stuff)
> | error;
> `-*-
>
> then join buffer init, usb init together and final register, after
> it. Thus to have second erroneous path.
If I understand this code correctly the allocated buffers end up as
buffers used in URBs. If that is the case you must allocate each of
them separately with kmalloc() or usb_alloc_buffer() or you violate
DMA constraints on non-coherent architectures (eg. ppc)
Regards
Oliver
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]