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

In dpio_exit there is a NULL check for dflt_dpio but it happens after
dpio_dflt has been dereferenced a number of times already. Instead move
the NULL check to first thing in the function. Also assign NULL to
dflt_dpio after free in both dpio_init and dpio_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