On Thu, Jun 09, 2016 at 01:37:23PM -0600, Eric Blake wrote: [...] > > Hmm - it seems like in most of the cases where the ONLY thing done in > the if (local_err) block is to propagate the error, we should instead be > directly assigning to errp instead of wasting a local variable. At this > point, my review is repetitive enough that I'll stop looking, and leave > it up to you and Markus whether to attempt a more ambitious Coccinelle > script.
If it happens immediately before the function end or a return statement it should be easy, but it would still require some manual work to remove the unused variable declaration. Probably easier to do that in a follow-up patch. It's harder (impossible?) to make Coccinelle avoid matching if local_err is used somewhere else in the function. But it's probably doable with some manual work, in a follow-up patch. -- Eduardo