On Wed, Oct 29, 2014 at 05:26:34PM +0800, [email protected] wrote: > The memset in ida_init() already handles idr, so there's some > redundancy in the following idr_init(). > > This patch removes the memset, and clears ida->free_bitmap instead. > > Signed-off-by: pang.xunlei <[email protected]> > --- > lib/idr.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/lib/idr.c b/lib/idr.c > index e654aeb..bbe5779 100644 > --- a/lib/idr.c > +++ b/lib/idr.c > @@ -1141,8 +1141,7 @@ EXPORT_SYMBOL(ida_simple_remove); > */ > void ida_init(struct ida *ida) > { > - memset(ida, 0, sizeof(struct ida)); > idr_init(&ida->idr); > - > + ida->free_bitmap = NULL;
I don't know. Does this matter? If this *really* matters, I'd much rather have memset(&ida->FIRST_FIELD, 0, sizeof(struct ida) - offset of FIRST_FIELD) to ensure that all fields get reset or implement an internal function like __idr_init_without_zeroing(); however, given the size of an idr and the low frequency of the operation, I'd prefer to just leave it as-is. Thanks. -- tejun -- 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/

