Mailing List Archive

[PATCH v2 5/5] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct
From: Suniel Mahesh <sunil.m@techveda.org>

Prefer vzalloc(sizeof(*priv->pFirmware)...) over
vzalloc(sizeof(struct rt_firmware)...) as reported by checkpatch.pl

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Changes for v2:

- new patch addition to the series
- Rebased on top of next-20170306
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index fb711d2..a099bce 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -965,7 +965,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)

priv->card_type = PCI;

- priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
+ priv->pFirmware = vzalloc(sizeof(*priv->pFirmware));
if (!priv->pFirmware)
return -ENOMEM;
skb_queue_head_init(&priv->skb_queue);
--
1.9.1
Re: [PATCH v2 5/5] staging: rtl8192e: Pass a pointer as an argument to sizeof() instead of struct [ In reply to ]
On Friday 10 March 2017 12:20 AM, sunil.m@techveda.org wrote:
> From: Suniel Mahesh <sunil.m@techveda.org>
>
> Prefer vzalloc(sizeof(*priv->pFirmware)...) over
> vzalloc(sizeof(struct rt_firmware)...) as reported by checkpatch.pl
>
> Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
> ---
> Changes for v2:
>
> - new patch addition to the series
> - Rebased on top of next-20170306
> ---
> drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> index fb711d2..a099bce 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> @@ -965,7 +965,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
>
> priv->card_type = PCI;
>
> - priv->pFirmware = vzalloc(sizeof(struct rt_firmware));
> + priv->pFirmware = vzalloc(sizeof(*priv->pFirmware));
> if (!priv->pFirmware)
> return -ENOMEM;
> skb_queue_head_init(&priv->skb_queue);
>
ok