]> Gentwo Git Trees - linux/.git/commit
net: ti: icssm-prueth: unwind cleanly in probe()
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 18 Sep 2025 09:48:26 +0000 (12:48 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 19 Sep 2025 23:58:25 +0000 (16:58 -0700)
commit5fc7fa743dbfcc98c3210ac4a724c88f3e8718d8
tree801b2bcea44eda64f163ba83e6306baac4d35080
parentb1e5dfa6d8dfa1bdb416c8ff43a3c526c4d00e4f
net: ti: icssm-prueth: unwind cleanly in probe()

This error handling triggers a Smatch warning:

    drivers/net/ethernet/ti/icssm/icssm_prueth.c:1574 icssm_prueth_probe()
    warn: 'prueth->pru1' is an error pointer or valid

The warning is harmless because the pru_rproc_put() function has an
IS_ERR_OR_NULL() check built in.  However, there is a small bug if
syscon_regmap_lookup_by_phandle() fails.  In that case we should call
of_node_put() on eth0_node and eth1_node.

It's a little bit easier to re-write this code to only free things which
we know have been allocated successfully.

Fixes: 511f6c1ae093 ("net: ti: icssm-prueth: Adds ICSSM Ethernet driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Parvathi Pudi <parvathi@couthit.com>
Link: https://patch.msgid.link/aMvVagz8aBRxMvFn@stanley.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ti/icssm/icssm_prueth.c