]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: virtio: Fix confusing cleanup.h syntax
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Mon, 8 Dec 2025 02:08:31 +0000 (03:08 +0100)
committerMark Brown <broonie@kernel.org>
Sun, 14 Dec 2025 10:39:28 +0000 (19:39 +0900)
commite6268db46c173b18e5b2f4fc0c8a5c0aaaee61ea
tree066b74ba5361dc9c76d7b11736f73ff46a1cfbe1
parent9f0736a4e136a6eb61e0cf530ddc18ab6d816ba3
spi: virtio: 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>
Link: https://patch.msgid.link/20251208020830.5225-2-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-virtio.c