Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4489267rwb; Tue, 6 Sep 2022 08:12:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR59DOLhA78oM1xh4EYki+IU5LwdRKFQ7tPRrpAIOERdcm1yrrca9JdkjaM1PILlr+o4WEgI X-Received: by 2002:a17:902:b194:b0:176:d229:83bd with SMTP id s20-20020a170902b19400b00176d22983bdmr3238768plr.174.1662477156359; Tue, 06 Sep 2022 08:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662477156; cv=none; d=google.com; s=arc-20160816; b=mPhuu5SssgBxxj6Mlp3zsEA0EsBUIFO/5/S2W+6L5tNf6pwxSBLF1qZ2ldf5JxTsk5 1JVjFO0/zrIxuRLlkmmtOZwCTLA1In8tYn2qUHomHHtqxvcT57D6LCzcC6OPwTv+rbjb BHZmKLHSz18rxi6PAFwhF8nd1ejqPyyH6WCscaFDZajH48xba9PNmKcznuhrVaVXuipi cPZLV/9xgOCXUncV895EcP/BgElQH4Xj9xHV2y5049H6+Pp0OgN5cpBeQ4LkZitdajel N2PbmJG1/jK9+PsM6lVnOsfs54C4k2d1iHh1Hha1ojBfRkwHv6D/3R7nmdJ1HqlEBjdR 0QQw== 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=6GEY6biV/7J3+YY30daSkYmQ3SYGED6qB8FYQnvM+xY=; b=rnEKKUBeu87MK8yO9H378dz+WX0IdVRRcd3Rv6vGuEe13wE0rrpmrTEXwD+TiZIZVl MtUZhpFkuY/TliDaqJw1TpXtwJSeTh6bc32rQduds87+syCwAyba+S43Uux4LRr7Knrj 0TDoHqyJL8zfU2XDVT7oxLLPqdMN50bG15pKCznOjYcF11F2OhaRSL7w2joyyrXY/+pi 2Kps2nlFgsF/zF+VvZaJGkx5WESBKIKGD/vWQBNaoY5D5XKO4Tharqfc78E6LJTXNgFd /md1oRtxwtrmoKbZyLfFp9NlThY8MxUd7GZh9wWdRqKMRp8H30yfR/k7SovrbTwiKKQU Nxrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k0xXjkU5; 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 d13-20020a170902e14d00b00176d89d640asi1050000pla.440.2022.09.06.08.12.25; Tue, 06 Sep 2022 08:12:36 -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=k0xXjkU5; 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 S241633AbiIFOVJ (ORCPT + 99 others); Tue, 6 Sep 2022 10:21:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241712AbiIFOSn (ORCPT ); Tue, 6 Sep 2022 10:18:43 -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 997331C926; Tue, 6 Sep 2022 06:49:49 -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 989A3614C9; Tue, 6 Sep 2022 13:48:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0E24C433C1; Tue, 6 Sep 2022 13:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662472133; bh=oj6S6u7ID0zurfZo8QLHyKdOaSa7uRcqc9fSYPzbozM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k0xXjkU5P3OS7hu0z4Cg00SULm14jRvHT2lhBYdq6nRgEk86yIDY+bcGo6AsPZx68 D7YlqJn0a+kg0+S5oEBveW3Zj4Gzw9XgK4M1dc+3Bbuf7GGN6HtsqfIdTquo61zfQu IGwy2uzxEDu0qhG2aul5y9UdYdXdMgDOXKKGhy0Q= 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.19 138/155] driver core: Dont probe devices after bus_type.match() probe deferral Date: Tue, 6 Sep 2022 15:31:26 +0200 Message-Id: <20220906132835.298442319@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@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 @@ -897,6 +897,11 @@ static int __device_attach_driver(struct dev_dbg(dev, "Device match requests probe deferral\n"); dev->can_match = true; 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; @@ -1136,6 +1141,11 @@ static int __driver_attach(struct device dev_dbg(dev, "Device match requests probe deferral\n"); dev->can_match = true; 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;