Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4372645rwb; Tue, 6 Sep 2022 06:43:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR7do9gkCMA+j9LJ3v/EaNUhpK8zPEaaE08DCXBveaiB+Xx3ehIUoWACrLnr+tnKQYeRTCJ5 X-Received: by 2002:aa7:c545:0:b0:44e:a7a7:bc66 with SMTP id s5-20020aa7c545000000b0044ea7a7bc66mr5901380edr.70.1662471799572; Tue, 06 Sep 2022 06:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662471799; cv=none; d=google.com; s=arc-20160816; b=FS9op/RfcNnSi2IPWN295hiNzpgXj6ExM9u3WF9vM/OPOfknNhCaeR3mlyEU55gC0I sAIAqHd27eowoNA+SimEU4QvQgP79XflOs243yA24X+TIByk3xfTRrAHyX19k9hP/28I X5mt5J8fFVfBc8rPsIU5aem7uJ7z5sJ75CBZdeBhElXhfkg5xJesq+tYj2FLhpBrhmQV Ps1m9GY9iN8BbGnFPOaLgMHbI/CaVdYJVfYWJuEZCiMQHGRHltmQM3g+48PjG9pD9B68 Zgt07NXEF8rZhtQvLQ2UHlcL7VVrazBpPpgSz60zB9T4fwmuh1bbcmDKMPTEV8PbmH/P xxsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pnok+SKMmehdBBMQEx7Ax8jpAqQKyDLJ9C4u2qPHrvI=; b=RkFXc238ttrHuykkbg0PAXZ67OF2gOVIcl8PuI9sFDHT93qoW+DYVSN9b2I8kSit3u eo+WUJoSj9JG8PTZqziBWeiwsrCD7JiQVyjpJWsmDJ7HJwdXHBmdMRrpxhY7k8TtNS6D B0KMuxYTrBb3V41/JI5Xh+HHD6xTEtnW2+hPNwDwF2DFcaOJG7XrR1dIgEFhhu9fuX4A yoe9uvgMSIRRIJY2vmPUAxXAZUCuZWGvuvASbMHRUcikS89kpnz3RBwmAEUqJl1PlJAp FOzGWdKBmXyzc9t2UAZhSCSnJiwaPw3VhwSnAbx1Pf+0/jZDeSRGQqU2Hgbnv3y4dod0 uYaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UBKZiGz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds7-20020a170907724700b007417ca60a22si10663896ejc.38.2022.09.06.06.42.53; Tue, 06 Sep 2022 06:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UBKZiGz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234204AbiIFNkf (ORCPT + 99 others); Tue, 6 Sep 2022 09:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240883AbiIFNjB (ORCPT ); Tue, 6 Sep 2022 09:39:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B8397C32E; Tue, 6 Sep 2022 06:36:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 05A246154D; Tue, 6 Sep 2022 13:35:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06057C433C1; Tue, 6 Sep 2022 13:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471302; bh=B8lJ8ixrg6hdvMKNMa7eV0Jf+pWpMEyy8RjV3/RHVis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UBKZiGz544aM8weyxFa2zQxWzRYXrFYBLPyQ3r/nlDouZepFlMLT6ZGU7sFdwBDE6 SLwC12fGsDJh4NMxGL33pyQUsWnJ1uu/2OABpM6qgc+f3AZsP/NCP5wBQUAxol72pb jcVtvo87WWz1qzL6Fvw13j7xn+e8d1K5AvBEuZk0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saravana Kannan , Guenter Roeck , Linus Walleij , "Isaac J. Manjarres" Subject: [PATCH 5.10 64/80] driver core: Dont probe devices after bus_type.match() probe deferral Date: Tue, 6 Sep 2022 15:31:01 +0200 Message-Id: <20220906132819.737567417@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132816.936069583@linuxfoundation.org> References: <20220906132816.936069583@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Isaac J. Manjarres commit 25e9fbf0fd38868a429feabc38abebfc6dbf6542 upstream. Both __device_attach_driver() and __driver_attach() check the return code of the bus_type.match() function to see if the device needs to be added to the deferred probe list. After adding the device to the list, the logic attempts to bind the device to the driver anyway, as if the device had matched with the driver, which is not correct. If __device_attach_driver() detects that the device in question is not ready to match with a driver on the bus, then it doesn't make sense for the device to attempt to bind with the current driver or continue attempting to match with any of the other drivers on the bus. So, update the logic in __device_attach_driver() to reflect this. If __driver_attach() detects that a driver tried to match with a device that is not ready to match yet, then the driver should not attempt to bind with the device. However, the driver can still attempt to match and bind with other devices on the bus, as drivers can be bound to multiple devices. So, 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 Reported-by: Guenter Roeck Tested-by: Guenter Roeck Tested-by: Linus Walleij Reviewed-by: Saravana Kannan Signed-off-by: Isaac J. Manjarres Link: https://lore.kernel.org/r/20220817184026.3468620-1-isaacmanjarres@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/base/dd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -837,6 +837,11 @@ static int __device_attach_driver(struct } else if (ret == -EPROBE_DEFER) { dev_dbg(dev, "Device match requests probe deferral\n"); driver_deferred_probe_add(dev); + /* + * Device can't match with a driver right now, so don't attempt + * to match or bind with other drivers on the bus. + */ + return ret; } else if (ret < 0) { dev_dbg(dev, "Bus failed to match device: %d\n", ret); return ret; @@ -1076,6 +1081,11 @@ static int __driver_attach(struct device } else if (ret == -EPROBE_DEFER) { dev_dbg(dev, "Device match requests probe deferral\n"); driver_deferred_probe_add(dev); + /* + * Driver could not match with device, but may match with + * another device on the bus. + */ + return 0; } else if (ret < 0) { dev_dbg(dev, "Bus failed to match device: %d\n", ret); return ret;