Commit c6b486f
net: ethernet: ti: am65-cpsw: Fix mdio cleanup in probe
In the am65_cpsw_nuss_probe() function's cleanup path, the call to
of_platform_device_destroy() for the common->mdio_dev device is invoked
unconditionally. It is possible that either the MDIO node is not present
in the device-tree, or the MDIO node is disabled in the device-tree. In
both these cases, the MDIO device is not created, resulting in a NULL
pointer dereference when the of_platform_device_destroy() function is
invoked on the common->mdio_dev device on the cleanup path.
Fix this by ensuring that the common->mdio_dev device exists, before
attempting to invoke of_platform_device_destroy().
Fixes: a45cfcc ("net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Link: https://lore.kernel.org/r/20230403090321.835877-1-s-vadapalli@ti.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>1 parent ea30388 commit c6b486f
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2926 | 2926 | | |
2927 | 2927 | | |
2928 | 2928 | | |
2929 | | - | |
| 2929 | + | |
| 2930 | + | |
2930 | 2931 | | |
2931 | 2932 | | |
2932 | 2933 | | |
| |||
2956 | 2957 | | |
2957 | 2958 | | |
2958 | 2959 | | |
2959 | | - | |
| 2960 | + | |
| 2961 | + | |
2960 | 2962 | | |
2961 | 2963 | | |
2962 | 2964 | | |
| |||
0 commit comments