Re: [PATCH 3/8] Staging: bcm: Remove typedef for _stLocalSFAddIndication and call directly.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 24, 2012 at 09:46:05AM -0400, Kevin McKinney wrote:
> On Mon, Sep 24, 2012 at 6:57 AM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> > On Sun, Sep 23, 2012 at 11:07:12PM -0400, Kevin McKinney wrote:
> >> -     pstAddIndication = kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
> >> +     pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), GFP_KERNEL);
> >
> > Don't resend, but the style was still better in the original.
> 
> Okay, I can change the style back to the original in a future patch?
> That is no problem, but I am not sure what style you are referring?
> Are you referring to this: "sizeof(struct bcm_add_indication)"?  Do
> you want me to change this statement?
> 

It's not worth worrying about given the other problems in bcm.  :P
But I only complained about it because that line was an unneeded
change to begin with.

Better:
	foo = kmalloc(sizeof(*foo), GFP_KERNEL);

Less preferred:
	foo = kmalloc(sizeof(struct foo_type), GFP_KERNEL);

When we're reading code the first one is easiest to read.  For that
we don't need to care about what type foo is, we're allocating one
of whatever it is.  For the second one then there is a small
possibility that we're "struct foo_type" doesn't match with how foo
is declared.  Or the other justification for preferring the first
way is that if we change the type of foo then we don't have to
change the kmalloc() line as well, it gets updated automatically.

This isn't in CodingStyle, but it's still better style.  It's an
unenforced rule.  ;)

> By the way, I was able to locate a complete setup / installation for
> this hardware here:
> https://sites.google.com/site/jrey42/Home/wimax
> http://developer.sprint.com/getDocument.do?docId=101032
> 
> I am going to try to get the hardware installed and working so I can
> test. Hopefully I can call sprint and get access in my area.  I am not
> sure, but I will try!

Sounds cool.  Rinat had this working.  Added to the CC list.  :)

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux