Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7117181rwl; Mon, 9 Jan 2023 18:23:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXug1jnXT+STP1B4t7LXgZ8q2lS+x71cTtwI1zi1LVwmPCc7+g64L7YW0UIxAyif6BnnLZsE X-Received: by 2002:a62:b617:0:b0:577:b52:4ec2 with SMTP id j23-20020a62b617000000b005770b524ec2mr61096108pff.29.1673317410983; Mon, 09 Jan 2023 18:23:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673317410; cv=none; d=google.com; s=arc-20160816; b=FQsPCTBRybvPF05tHIIxehVKBg6fV2suJdmKHnSoiHO1hJE8FAvsOcp7Pnj05P7x4d BZRRyjSxYtsIRMu6D/M4x3YT1ICpTzVfA2qk2dquZjNBJvEc8fwzfQlSjIvOpkuKbM0E b6dOCzE8Ss9tjwjNQBAJETFxnCYv6y3JSv2hDvQ2t9tJoYXl8oQeSkUuEqK3s3kwYyBZ PQn/U99Cbydl0m/w8n6aavvs2uKwWM+c6dfMpa7ROG3AqbJ7erIg99m9lFk5k6ELKGwX qS5e2BA3uuJGjfKHy9xun4WFSp9isJErLXIzszjMgaf9LvCumBYXchwGqw0MX67IfGm2 gSsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=IKw0nHewfyAcnobo9890ROV/gGIwiBDCIMT9U0Fts4o=; b=vaHbIIwZsEqIZpc0rfmB5FLNzudu1jjf0wUKV8H0T/KVFPwYB29tzs2dN+9GYzWklw xAW9I790S3QB38L2ETR+K7h8gOF4P9TeDKIAiTmsy+euNQ6t+vDcUoLdFAk2WLCK8F7W EXm2pAQiQDzFgsHw7BsijiNYNrxeNyEulR+4WMlqIEKDjSOw4OM154268NTBuNoM1cLd UOk4Ji/Ye1uOC8OAmzRMzK7VkAuBALsAzP5tzSLXg4xn5XXIBdwewX1Z3MI38MB0dH18 GlYkf15W6vjkuyIsFN5xxHxtDcRjN7huEyq9aHTOvlI0lRzucVMa5HMEAB/8tL5p0Z+O DcGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=G1xR6AKc; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a056a000ac600b005830c8fe4besi10928884pfl.372.2023.01.09.18.23.24; Mon, 09 Jan 2023 18:23:30 -0800 (PST) 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=@google.com header.s=20210112 header.b=G1xR6AKc; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230438AbjAJCQC (ORCPT + 53 others); Mon, 9 Jan 2023 21:16:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230373AbjAJCP4 (ORCPT ); Mon, 9 Jan 2023 21:15:56 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 265E02198 for ; Mon, 9 Jan 2023 18:15:53 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-4c36d00c389so99656657b3.18 for ; Mon, 09 Jan 2023 18:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=IKw0nHewfyAcnobo9890ROV/gGIwiBDCIMT9U0Fts4o=; b=G1xR6AKcTXCuqCe/WpkaURQUMMo9N+steh6NueDOTfgV4+XkwHWE37rgGPopDug8S5 soKU9yJvMTRonXsEK26iN5U8Wz2+9KvrnRp1yTSyoxBwr3xNXX1jJofOFOZRWnEeyFgT rZdL+NnWcbO4czexO0OJdVbHA9ufSNhefzhqiy5d/n+Djom71HdUU9xvS5ecAMUugpwN yfyJLcweGDfjgGJaYNDp7/BxrhgAu6RY2wWpDWVnR9dwQFoLgsH9GtrhGVzgj9uylt9G YwCgiuS0a4jO+20aUPYE2VW/0ZCJ1S8LFHCqQDxv7iyTLsJv1GaF45UCx8zgfPOd40Zu DxiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IKw0nHewfyAcnobo9890ROV/gGIwiBDCIMT9U0Fts4o=; b=xecpIZcZn3VGQAWvUpe+aZqglPuXNezSIH6ers+0cWy2J8Urlq118gAAhBIjEi8Ugn dtgD8yfp6d+7kh+thmJlg7VtVVXWjDs3DgsJj2ijKvRGukBsLLFyFntA8aoRyIok0/Ve ybBO+qwHDN9rFELykGBGjxVKb8Z/BUlKlbxzEaaYgbJnnoqdy/oRb4qRynhAotOsiHd+ u8P1IljTaYSRQjOIx11niqNnTgVgWL058TAepPsmIC4oCXND+hcA5eOog9UsrV6w7kO5 CuO7+SAo9Yv+YZ1+h02OJJLvnR3uSs9zBT3ATPJdjPVknj18hjSNKf2XTEJUiHQwIPg7 Ao5A== X-Gm-Message-State: AFqh2kpUsGyv917qYhC9nfTOEq0suOgnZvA4nHPy6wu5U0sGfR1h4aal asosvKwP+cGtAv4zlLL9yuXXjNncAedhpEFFo8lLDQ== X-Received: from isaacmanjarres.irv.corp.google.com ([2620:15c:2d:3:3990:5e50:b0f8:bcdd]) (user=isaacmanjarres job=sendgmr) by 2002:a81:1441:0:b0:4bc:6c9c:bf9a with SMTP id 62-20020a811441000000b004bc6c9cbf9amr2865277ywu.255.1673316952380; Mon, 09 Jan 2023 18:15:52 -0800 (PST) Date: Mon, 9 Jan 2023 18:15:48 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230110021549.1347551-1-isaacmanjarres@google.com> Subject: [PATCH stable-4.19] driver core: Fix bus_type.match() error handling in __driver_attach() From: "Isaac J. Manjarres" To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Tomeu Vizoso , Russell King , Ulf Hansson , Marek Szyprowski Cc: "Isaac J. Manjarres" , stable@vger.kernel.org, Saravana Kannan , kernel-team@android.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 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 --- drivers/base/dd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 63390a416b44..2dad29292487 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -902,8 +902,12 @@ static int __driver_attach(struct device *dev, void *data) */ 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 && dev->bus->need_parent_lock) -- 2.39.0.314.g84b9a713c41-goog