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.

scsi: ufs: qcom: 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/20251208020807.5043-2-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Krzysztof Kozlowski and committed by
Martin K. Petersen
94657443 362432e9

+2 -4
+2 -4
drivers/ufs/host/ufs-qcom.c
··· 1769 { 1770 struct ufs_qcom_host *host = ufshcd_get_variant(hba); 1771 int i, j, nminor = 0, testbus_len = 0; 1772 - u32 *testbus __free(kfree) = NULL; 1773 char *prefix; 1774 1775 - testbus = kmalloc_array(256, sizeof(u32), GFP_KERNEL); 1776 if (!testbus) 1777 return; 1778 ··· 1793 static int ufs_qcom_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, 1794 const char *prefix, void __iomem *base) 1795 { 1796 - u32 *regs __free(kfree) = NULL; 1797 size_t pos; 1798 1799 if (offset % 4 != 0 || len % 4 != 0) 1800 return -EINVAL; 1801 1802 - regs = kzalloc(len, GFP_ATOMIC); 1803 if (!regs) 1804 return -ENOMEM; 1805
··· 1769 { 1770 struct ufs_qcom_host *host = ufshcd_get_variant(hba); 1771 int i, j, nminor = 0, testbus_len = 0; 1772 char *prefix; 1773 1774 + u32 *testbus __free(kfree) = kmalloc_array(256, sizeof(u32), GFP_KERNEL); 1775 if (!testbus) 1776 return; 1777 ··· 1794 static int ufs_qcom_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, 1795 const char *prefix, void __iomem *base) 1796 { 1797 size_t pos; 1798 1799 if (offset % 4 != 0 || len % 4 != 0) 1800 return -EINVAL; 1801 1802 + u32 *regs __free(kfree) = kzalloc(len, GFP_ATOMIC); 1803 if (!regs) 1804 return -ENOMEM; 1805