[PATCH 13/15] drm: Eliminate pointless goto

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Mar 15 10:17:13 PDT 2012


On Thu, Mar 15, 2012 at 09:57:53AM +0000, Dave Airlie wrote:
> > Use a do {} while() loop instead of a goto in drm_mode_object_get().
> 
> I don't like this one just because it diverges our idr usage from the
> canonical idr usage at
> 
> http://lwn.net/Articles/103209/
> 
> So unless there is a good reason for the change I'd rather not apply it.

That's fine by me. Although "canonical" may be an overstatement. I just
quickly went through the idr_pre_get() usage in the tree, and between
the three conteders (no loop, goto loop, while loop) it was a close
race. No loop won with 29 idr_pre_get()s, goto loop came in second
with 24, and while loop came in third with 21.

The drm subsystem itself seems to have 5 goto loops. So if we were to
change them all, goto loop would lose to the while loop.

> I've applied the other patches except this and the last one which I
> think depends on it.

The error handling in the goto version is equally broken. I'll respin
the patch on top of the goto version, and I'll check the other idr
usage under drm as well...

-- 
Ville Syrjälä
Intel OTC


More information about the dri-devel mailing list