Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6770275rwn; Tue, 13 Sep 2022 08:48:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR4QB0u80wzYlESdGFL5rlIPrUVgYzSyzSnKRU5BHQyt0eiWySP9o7OzN6l4os6ICBtlhXvG X-Received: by 2002:a17:907:2d0d:b0:77c:d528:70b8 with SMTP id gs13-20020a1709072d0d00b0077cd52870b8mr7970847ejc.681.1663084087022; Tue, 13 Sep 2022 08:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663084087; cv=none; d=google.com; s=arc-20160816; b=wtOtKjswDLstji4qpiLzypF70nY9rmsWc6eO/x4qo8mN5K2HGzt0Ls6iMwlkT0ubyN Mhzylke4g5jUDzuhfsArtuBEPbWsm6vdFBGKhLyy7WdB2ZnwsG2QVqROGUJ+Oi8M60kC K+96vMg6PcNODsKFqwgqJCGgEaDQeA71cWX5n5tPJFzItL/cQXT4LIY/V3gcegSQ7TaG Qu13J4POgRxFLFNkrtimBaW1eacIZY7oIJPiEQS2KqF9aTJmQeM0aZs+8OxeE2TCv6Pn Y/zFuQO6cVymm5wLDnr22n9VbMsrXMYtjgFpKuQJVrz1OwVmbdCRnwc05LW4Ze848Tga 9HJQ== 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=gNaTxknTn3/0fuqmBybEA85PNk5/YgMesVzQrnd5DUk=; b=kp3l13v546IEUdEj3fL8tIHC8c78hjUzmYZv6RagvL2pO6+8oV+WpgWushDpdAfpTN tJ5SSHgruej1+lDipFfZH4ipvCsjx5B9CsSYUhtbRFhwc2h0g83GpnZWYJpy+H9/3jOd MGvQYhTVdHTAauEAPcuRavz8nhFxjsqNSTtphqzkI1GGlfQ+7+idzHlG4/Z651adZfKl B0AI2dSN//2fFmgUQb+HTIqlkLfYXnz5RVicoQe8Xbbe+0gm4iQs9ArAyFoiZ1m+F1yZ WWjOx85Bye5nYK3PctJsAyqTAJnFWfsfNbfAd0ICN9xexhYgHStiGapiiG3VRXJKwKr3 WeYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pZw4Vw0Z; 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 dz10-20020a0564021d4a00b00448da245f3bsi11312141edb.6.2022.09.13.08.47.40; Tue, 13 Sep 2022 08:48:07 -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=pZw4Vw0Z; 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 S236249AbiIMPZf (ORCPT + 99 others); Tue, 13 Sep 2022 11:25:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236061AbiIMPXO (ORCPT ); Tue, 13 Sep 2022 11:23:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA2FE6B166; Tue, 13 Sep 2022 07:37:17 -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 ams.source.kernel.org (Postfix) with ESMTPS id EB2E1B80FEF; Tue, 13 Sep 2022 14:35:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56EDAC433C1; Tue, 13 Sep 2022 14:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079721; bh=zYaDdJz9diUBs1H5IFFAx43U/MSdBjIdA6RKKH+n28M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZw4Vw0Zr4hjngWnaYgpgq/b+ubGV8bhoiEZuzpVlvTzB6bFxeXiumvVicrAb+1N1 kwhi1Zg5dyXsDyyKjMeJ1wTU/C6LCdsyojRUGr+GnictzRW4/y/+AxVCAP5nUooSmQ s6Y5CSDxDMMPFGLEi/yy9lOzO7G3LP1Mj6UI+59U= 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 4.14 49/61] driver core: Dont probe devices after bus_type.match() probe deferral Date: Tue, 13 Sep 2022 16:07:51 +0200 Message-Id: <20220913140348.921485984@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140346.422813036@linuxfoundation.org> References: <20220913140346.422813036@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 @@ -632,6 +632,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", ret); return ret; @@ -774,6 +779,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", ret); return ret;