On Thursday 28 June 2012 22:00:41 thomas wrote: > Hi Julian, > > Compiler wise both of our suggestions will lead to the same machine code. > So beside the matter of taste, I just followed the other overall usage > pattern of kzalloc in minstrel_ht. > And it seems to be explicitly using the struct type. http://lxr.linux.no/linux/Documentation/CodingStyle Chapter 14: Allocating memory The kernel provides the following general purpose memory allocators: kmalloc(), kzalloc(), kcalloc(), vmalloc(), and vzalloc(). Please refer to the API documentation for further information about them. The preferred form for passing a size of a struct is the following: p = kmalloc(sizeof(*p), ...); The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed but the corresponding sizeof that is passed to a memory allocator is not. Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language. -- Franz Schrober -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html