From 8717d3172cb087d49652c33b708ea0c7f5248932 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 12 Jan 2023 13:55:05 +0100 Subject: [PATCH] 4.14-stable patches added patches: driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch ravb-fix-failed-to-switch-device-to-config-mode-message-during-unbind.patch --- ...ch-error-handling-in-__driver_attach.patch | 48 ++++++++++++++ ...to-config-mode-message-during-unbind.patch | 63 +++++++++++++++++++ queue-4.14/series | 2 + 3 files changed, 113 insertions(+) create mode 100644 queue-4.14/driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch create mode 100644 queue-4.14/ravb-fix-failed-to-switch-device-to-config-mode-message-during-unbind.patch diff --git a/queue-4.14/driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch b/queue-4.14/driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch new file mode 100644 index 00000000000..65ee2d05c15 --- /dev/null +++ b/queue-4.14/driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch @@ -0,0 +1,48 @@ +From 27c0d217340e47ec995557f61423ef415afba987 Mon Sep 17 00:00:00 2001 +From: "Isaac J. Manjarres" +Date: Tue, 20 Sep 2022 17:14:13 -0700 +Subject: driver core: Fix bus_type.match() error handling in __driver_attach() + +From: Isaac J. Manjarres + +commit 27c0d217340e47ec995557f61423ef415afba987 upstream. + +When a driver registers with a bus, it will attempt to match with every +device on the bus through the __driver_attach() function. Currently, if +the bus_type.match() function encounters an error that is not +-EPROBE_DEFER, __driver_attach() will return a negative error code, which +causes the driver registration logic to stop trying to match with the +remaining devices on the bus. + +This behavior is not correct; a failure while matching a driver to a +device does not mean that the driver won't be able to match and bind +with other devices on the bus. Update the logic in __driver_attach() +to reflect this. + +Fixes: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()") +Cc: stable@vger.kernel.org +Cc: Saravana Kannan +Signed-off-by: Isaac J. Manjarres +Link: https://lore.kernel.org/r/20220921001414.4046492-1-isaacmanjarres@google.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/base/dd.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -785,8 +785,12 @@ static int __driver_attach(struct device + */ + return 0; + } else if (ret < 0) { +- dev_dbg(dev, "Bus failed to match device: %d", ret); +- return ret; ++ dev_dbg(dev, "Bus failed to match device: %d\n", ret); ++ /* ++ * Driver could not match with device, but may match with ++ * another device on the bus. ++ */ ++ return 0; + } /* ret > 0 means positive match */ + + if (dev->parent) /* Needed for USB */ diff --git a/queue-4.14/ravb-fix-failed-to-switch-device-to-config-mode-message-during-unbind.patch b/queue-4.14/ravb-fix-failed-to-switch-device-to-config-mode-message-during-unbind.patch new file mode 100644 index 00000000000..2ebb86abda9 --- /dev/null +++ b/queue-4.14/ravb-fix-failed-to-switch-device-to-config-mode-message-during-unbind.patch @@ -0,0 +1,63 @@ +From c72a7e42592b2e18d862cf120876070947000d7a Mon Sep 17 00:00:00 2001 +From: Biju Das +Date: Wed, 14 Dec 2022 10:51:18 +0000 +Subject: ravb: Fix "failed to switch device to config mode" message during unbind + +From: Biju Das + +commit c72a7e42592b2e18d862cf120876070947000d7a upstream. + +This patch fixes the error "ravb 11c20000.ethernet eth0: failed to switch +device to config mode" during unbind. + +We are doing register access after pm_runtime_put_sync(). + +We usually do cleanup in reverse order of init. Currently in +remove(), the "pm_runtime_put_sync" is not in reverse order. + +Probe + reset_control_deassert(rstc); + pm_runtime_enable(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); + +remove + pm_runtime_put_sync(&pdev->dev); + unregister_netdev(ndev); + .. + ravb_mdio_release(priv); + pm_runtime_disable(&pdev->dev); + +Consider the call to unregister_netdev() +unregister_netdev->unregister_netdevice_queue->rollback_registered_many +that calls the below functions which access the registers after +pm_runtime_put_sync() + 1) ravb_get_stats + 2) ravb_close + +Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") +Cc: stable@vger.kernel.org +Signed-off-by: Biju Das +Reviewed-by: Leon Romanovsky +Link: https://lore.kernel.org/r/20221214105118.2495313-1-biju.das.jz@bp.renesas.com +Signed-off-by: Paolo Abeni +Signed-off-by: Biju Das +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/renesas/ravb_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -2195,11 +2195,11 @@ static int ravb_remove(struct platform_d + priv->desc_bat_dma); + /* Set reset mode */ + ravb_write(ndev, CCC_OPC_RESET, CCC); +- pm_runtime_put_sync(&pdev->dev); + unregister_netdev(ndev); + netif_napi_del(&priv->napi[RAVB_NC]); + netif_napi_del(&priv->napi[RAVB_BE]); + ravb_mdio_release(priv); ++ pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); + free_netdev(ndev); + platform_set_drvdata(pdev, NULL); diff --git a/queue-4.14/series b/queue-4.14/series index 1713ec6b60a..b47a34fa513 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -319,3 +319,5 @@ nfsd-fix-handling-of-readdir-in-v4root-vs.-mount-upcall-timeout.patch hfs-hfsplus-use-warn_on-for-sanity-check.patch hfs-hfsplus-avoid-warn_on-for-sanity-check-use-proper-error-handling.patch parisc-align-parisc-madv_xxx-constants-with-all-other-architectures.patch +driver-core-fix-bus_type.match-error-handling-in-__driver_attach.patch +ravb-fix-failed-to-switch-device-to-config-mode-message-during-unbind.patch -- 2.47.3