Re: staging: vt6656: Use common error handling code in vnt_alloc_bufs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Your patch remove redundant code, which is fine.

Thanks for your constructive feedback.


> code you changed was simple enough to be understand quickly. I think replacing
> it with a crossed goto (even if it remove redundant code) might not be the best
> option.
>
> A solution might be to move the second loop to the top of the function

I am unsure about the relevance of the loop ordering for the affected
resource allocations.


> so you should be able to replace the end of the cleanup calls with:
>
> enomem:
> 	ret = -ENOMEM;
> free_rx:
> 	vnt_free_rx_bufs(priv);
> 	return ret;

The exception handling can eventually adjusted another bit according
to your refactoring.


> This way, only a failed call to vnt_submit_rx_urb() should jump to free_rx,

It seems that a goto statement will still be needed in an error code
part by both discussed variants.


> another failed call should jump to enomem or previously defined
> label, so we can correctly forward errors.

This view sounds promising.


> With such solution it might be worth adding a comment to describe
> that all error should be ENOMEM except for vnt_submit_rx_urb().

Can this function implementation become clearer also without
such a comment?

Regards,
Markus
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux