[PATCH net] net: ethernet: ti: am65-cpsw: Fix mdio cleanup in probe

Roger Quadros rogerq at kernel.org
Mon Apr 3 03:49:58 PDT 2023



On 03/04/2023 12:03, Siddharth Vadapalli wrote:
> 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: a45cfcc69a25 ("net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio")
> Signed-off-by: Siddharth Vadapalli <s-vadapalli at ti.com>

Reviewed-by: Roger Quadros <rogerq at kernel.org>



More information about the linux-arm-kernel mailing list