mmc: owl_mmc: Do not dereference data before NULL check
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 31 Jul 2025 11:11:47 +0000 (12:11 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 28 Oct 2025 16:32:59 +0000 (10:32 -0600)
commit6e382d8fc5ee6876ade500222cb0ade9cdc597ed
treebc235402fb86b509fd4a474585b67aa6019d8f02
parente8fd262fb3e2c2516610fac6389764e0dbfd98d7
mmc: owl_mmc: Do not dereference data before NULL check

In owl_mmc_prepare_data there is a NULL check for the pointer data but
it happens after data has already been dereferenced. Refactor the code
so that the NULL check happens before any code dereferences data.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/mmc/owl_mmc.c