net: fsl-mc: NULL check dflt_dpni before dereference
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Mon, 4 Aug 2025 16:56:58 +0000 (17:56 +0100)
committerPeng Fan <peng.fan@nxp.com>
Wed, 27 Aug 2025 07:42:08 +0000 (15:42 +0800)
commit010a4c5c553763430b3e9628ae2c82de3d5f45dd
treeedb456deca6f9d5980149ed2cdf3d2231dfcc18b
parent9ca756cee7e8f9d6ecc0a69fa785caabd61f3f6a
net: fsl-mc: NULL check dflt_dpni before dereference

In dpni_exit there is a NULL check for dflt_dpni after it is
dereferenced a number of times. Instead move the NULL check to early in
the function. Also assign NULL to dflt_dpni after free in both dpni_init
and dpni_exit.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/net/fsl-mc/mc.c