[PATCH 2/4] ath10k: use sizeof(*var) in kmalloc

Kalle Valo kvalo at qca.qualcomm.com
Mon Aug 12 10:26:37 EDT 2013


Michal Kazior <michal.kazior at tieto.com> writes:

> This fixes checkpatch warning from the latest
> 3.11-rc kernel tree.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
> index d95439b..1814af1 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -803,8 +803,7 @@ static int ath10k_pci_start_ce(struct ath10k *ar)
>  			continue;
>  
>  		for (i = 0; i < completions; i++) {
> -			compl = kmalloc(sizeof(struct ath10k_pci_compl),
> -					GFP_KERNEL);
> +			compl = kmalloc(sizeof(*compl), GFP_KERNEL);
>  			if (!compl) {
>  				ath10k_warn("No memory for completion state\n");
>  				ath10k_pci_stop_ce(ar);

Just out of curiosity, what's the warning? kmalloc() should be called
with sizeof(*foo) style?

-- 
Kalle Valo



More information about the ath10k mailing list