Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: dw-edma: Fix confusing cleanup.h syntax

Initializing automatic __free variables to NULL without need (e.g.
branches with different allocations), followed by actual allocation is
in contrary to explicit coding rules guiding cleanup.h:

"Given that the "__free(...) = NULL" pattern for variables defined at
the top of the function poses this potential interdependency problem the
recommendation is to always define and assign variables in one statement
and not group variable definitions at the top of the function when
__free() is used."

Code does not have a bug, but is less readable and uses discouraged
coding practice, so fix that by moving declaration to the place of
assignment.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20251208020729.4654-2-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Vinod Koul
f9ef8ded 8f0b4cce

+2 -2
+2 -2
drivers/dma/dw-edma/dw-edma-pcie.c
··· 161 161 const struct pci_device_id *pid) 162 162 { 163 163 struct dw_edma_pcie_data *pdata = (void *)pid->driver_data; 164 - struct dw_edma_pcie_data *vsec_data __free(kfree) = NULL; 165 164 struct device *dev = &pdev->dev; 166 165 struct dw_edma_chip *chip; 167 166 int err, nr_irqs; 168 167 int i, mask; 169 168 170 - vsec_data = kmalloc(sizeof(*vsec_data), GFP_KERNEL); 169 + struct dw_edma_pcie_data *vsec_data __free(kfree) = 170 + kmalloc(sizeof(*vsec_data), GFP_KERNEL); 171 171 if (!vsec_data) 172 172 return -ENOMEM; 173 173