Re: [PATCH 02/12] staging: dgnc: replaces generic struct from sizeof calls

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

 



On Sat, Aug 31, 2013 at 06:19:10PM -0400, Lidza Louina wrote:
> This patch replaces all instances of "sizeof(struct"
> with actual instances of the struct. For example
> "sizeof(struct tty_struct" is replaced with
> "sizeof(brd->SerialDriver.ttys".
> 

This one is not right.

> This patch affects driver.c, mgmt.c and tty.c.
> 

Btw, you don't need to say this in the commit.

> Signed-off-by: Lidza Louina <lidza.louina@xxxxxxxxx>
> ---
>  drivers/staging/dgnc/dgnc_driver.c |  2 +-
>  drivers/staging/dgnc/dgnc_mgmt.c   |  2 +-
>  drivers/staging/dgnc/dgnc_tty.c    | 28 ++++++++++++++--------------
>  3 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
> index 1e76f0c..9dee64c 100644
> --- a/drivers/staging/dgnc/dgnc_driver.c
> +++ b/drivers/staging/dgnc/dgnc_driver.c
> @@ -499,7 +499,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
>  
>  	/* get the board structure and prep it */
>  	brd = dgnc_Board[dgnc_NumBoards] =
> -	kzalloc(sizeof(struct board_t), GFP_KERNEL);
> +	kzalloc(sizeof(brd), GFP_KERNEL);

This should be "sizeof(*brd)".  The "brd" variable is a pointer (4 or
8 bytes) but we want the size of the struct it points to "*brd".  The
same thing for the some of the others as well.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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