On Mon, Feb 20, 2012 at 10:15:57AM -0800, pradheep.sh@xxxxxxxxx wrote: > -static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader,BOOLEAN *bParseDone,USHORT *pusPayloadLength) > +static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload, UCHAR *pucNextHeader, BOOLEAN *bParseDone, USHORT *pusPayloadLength) > { > UCHAR *pucRetHeaderPtr = NULL; > UCHAR *pucPayloadPtr = NULL; > - USHORT usNextHeaderOffset = 0 ; > - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); > - > - if((NULL == ppucPayload) || (*pusPayloadLength == 0) || (*bParseDone)) > - { > + USHORT usNextHeaderOffset = 0; > + IPV6RoutingHeader *pstIpv6RoutingHeader = NULL; > + IPV6DestOptionsHeader *pstIpv6DestOptsHdr = NULL; > + IPV6AuthenticationHeader *pstIpv6AuthHdr = NULL; > + int nTotalOptions = 0; > + int nHdrLen = 0; > + Which checkpatch complaints does this fix? That should be mentioned in the changelog probably. Anyway, it's the the wrong thing to do. The variables should be declared in the case block where they are used. It means that we don't have to read as much code to understand what is happenning. Also, don't initialize variables unless it's needed. You're turning off the gcc uninitialized variable warning for no reason. Occasionally I see bugs that GCC would have caught if only people hadn't initialized all their pointers to NULL without thinking about it. When gcc does give uninitialized warning messages then sure sometimes it's easy to just initialize it to NULL. The kernel also provides an uninitialized_var() macro to silence the warning. But the other thing you can do is to just handle the fall through default case. Maybe in a year or two we'll add some new PCI IDs or whatever and handling the unexpected conditions will mean the kernel doesn't crash. regards, dan carpenter
Attachment:
signature.asc
Description: Digital signature
_______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel