staging: mt7621-dma: sizeof via pointer dereference
authorBenjamin Sherman <benjamin@bensherman.io>
Thu, 30 May 2019 23:53:48 +0000 (23:53 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 00:22:47 +0000 (17:22 -0700)
Pass the size of a struct into kzalloc by pointer dereference.  This
complies with the Linux kernel coding style and removes the possibility
for a bug if the pointer's type is changed.

Signed-off-by: Benjamin Sherman <benjamin@bensherman.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/mt7621-dma/mtk-hsdma.c

index a58725d..60db067 100644 (file)
@@ -468,7 +468,7 @@ static struct dma_async_tx_descriptor *mtk_hsdma_prep_dma_memcpy(
        if (len <= 0)
                return NULL;
 
-       desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC);
+       desc = kzalloc(sizeof(*desc), GFP_ATOMIC);
        if (!desc) {
                dev_err(c->device->dev, "alloc memcpy decs error\n");
                return NULL;