From nobody Mon Sep 15 21:09:42 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13939C54EBD for ; Tue, 10 Jan 2023 02:16:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbjAJCQE (ORCPT ); Mon, 9 Jan 2023 21:16:04 -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-Google-Smtp-Source: AMrXdXvJ5CoYxQIPHJG2/AxrMkA6lDe+NURxnbNJQLBjRsRkvpcw9+qJgDURkx95PNDsjMjGB+P21cJ7nryjRzfGFTz9OQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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_t= ype.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 *d= ata) */ 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 */ =20 if (dev->parent && dev->bus->need_parent_lock) --=20 2.39.0.314.g84b9a713c41-goog