liquidio: Use vzalloc()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 27 May 2023 19:40:08 +0000 (21:40 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 30 May 2023 11:07:58 +0000 (13:07 +0200)
Use vzalloc() instead of hand writing it with vmalloc()+memset().
This is less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/93b010824d9d92376e8d49b9eb396a0fa0c0ac80.1685216322.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c

index 9ed3d1a..285d382 100644 (file)
@@ -719,12 +719,10 @@ static int cn23xx_setup_pf_mbox(struct octeon_device *oct)
        for (i = 0; i < oct->sriov_info.max_vfs; i++) {
                q_no = i * oct->sriov_info.rings_per_vf;
 
-               mbox = vmalloc(sizeof(*mbox));
+               mbox = vzalloc(sizeof(*mbox));
                if (!mbox)
                        goto free_mbox;
 
-               memset(mbox, 0, sizeof(struct octeon_mbox));
-
                spin_lock_init(&mbox->lock);
 
                mbox->oct_dev = oct;
index fda4940..b3bd276 100644 (file)
@@ -279,12 +279,10 @@ static int cn23xx_setup_vf_mbox(struct octeon_device *oct)
 {
        struct octeon_mbox *mbox = NULL;
 
-       mbox = vmalloc(sizeof(*mbox));
+       mbox = vzalloc(sizeof(*mbox));
        if (!mbox)
                return 1;
 
-       memset(mbox, 0, sizeof(struct octeon_mbox));
-
        spin_lock_init(&mbox->lock);
 
        mbox->oct_dev = oct;