From patchwork Mon Jul 17 18:26:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 121535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1280145vqt; Mon, 17 Jul 2023 11:37:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlG9Gb9QiGczqnGRzwGugn06j7tQNJ2/vJJ+Xhpp3M707/2ONHYL4i8cABjBoxpe43aB3nbN X-Received: by 2002:a17:907:75da:b0:987:5761:2868 with SMTP id jl26-20020a17090775da00b0098757612868mr12290514ejc.11.1689619049743; Mon, 17 Jul 2023 11:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689619049; cv=none; d=google.com; s=arc-20160816; b=O3ZlVj62lQ16GPbiyqDZFDPJYi8MKbbRpt1q6qlk8Jbt8uZjCtGAYieCMpLdVuGKRQ xTcuWaEg3XBKIMNqsPMKW2qpqnbU/G3QDxsDVOSH7bAJ7GNwCXyKWwKh5gtRGKEtbxfv 2lE3czFRDJc0tOsJ/2fnkBquQ5ihokne7d9KiX1OjaFXXEZyq3D4kq3hdsMifdP4pdKW 1x3fIvU1TheKJHFBzQtUZUphgr135u5dsyY6yHwYTzRrhtBR7a3hPdzfqVbQ6OUKHJgh 4WJZVdJEg0UzNQwQE/7x/8+OsHAHdiyk7j2079Wh0uX1MpxbhEeWqNoU6Ab2BkvysxB2 TrPw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=kBD2e0F/GIE7mK1/X5V+wBc0M2ODYA/DNmvWog50OLg=; fh=1FK6pZVJTeUlEjlxAx8ls09kjo5cIshjUQrwBTP4vxo=; b=taJIRYdlDEVW09ib/x2QElhMlGOcjHSa5IKQAUhG0Q/e51t2JQyKdIk1jaYst/lyAp qsUNYX42vE6qj+zJTCpE/oUQoWpoyYAagHG1GvrdDdgyfJQEh3A+5tN5eSyAyRgPQuXE 3+PxUfIiiCPG5GxHDv72FVIgQslTVab33kUYWD3RaGvGTfca52cJOmQYbBeTaf1bFn8G v7+7wPgiMGD0iBSVXcEPfktSmOxv4UCtFFplq0PNb+iRLhlawZfDe58GI0gQi+iLecDi Yl6otkplTsvXjzS7y5EHuglIk3ZMe0EV1k/EvvtSoC5ZE6tYH4aBVbrF0e1TvAHZ8GSz ngpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=c1l4uAXR; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a27-20020a170906369b00b00992ad8595fdsi20697ejc.464.2023.07.17.11.37.05; Mon, 17 Jul 2023 11:37:29 -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=@wanadoo.fr header.s=t20230301 header.b=c1l4uAXR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229812AbjGQS2f (ORCPT + 99 others); Mon, 17 Jul 2023 14:28:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230426AbjGQS1p (ORCPT ); Mon, 17 Jul 2023 14:27:45 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A59FF10FE for ; Mon, 17 Jul 2023 11:27:20 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id LSvbqI3jtF3kiLSvbqbtkE; Mon, 17 Jul 2023 20:26:36 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1689618396; bh=kBD2e0F/GIE7mK1/X5V+wBc0M2ODYA/DNmvWog50OLg=; h=From:To:Cc:Subject:Date; b=c1l4uAXRziFcIhZT/t3Uw/UFXsl+TJwWix1ioOHeSFvIFZ6DvWr09QihTxIxMORD5 qiy2AkAG0rwxrD7bHwlK6v+QGRf5d926XyNIIXXXHhDXiewD38cEIdXOhNtdx3pSKK KZAeM2NoF4FONJIcI6vMp7klOWKasReRg2alhAB68YcWU9vZoVxsZ6qTaGph2HaAjz /J7fYhPtqYRm0853vRvKbGfrfrUEEJ1TC++bONStiH/XybNJoceTPF6vvRrYaFlvhV G05HgPkR5sCzGXUMY9dY50jihldp77gvgYN7fMSdtKBOBvrdxMz4MWcYtddRYeFrXs fIpjneF9msctw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 17 Jul 2023 20:26:36 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Saravana Kannan Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] driver core: Fix an error handling path in fw_devlink_create_devlink() Date: Mon, 17 Jul 2023 20:26:30 +0200 Message-Id: <858b140b276ceab52a84ce0d4f924b0c411560d1.1689618373.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771693984690892828 X-GMAIL-MSGID: 1771693984690892828 All error handling paths go to 'out', except this one. Be consistent and also branch to 'out' here. Fixes: 74c782cff77b ("driver core: fw_devlink: Handle suppliers that don't use driver core") Signed-off-by: Christophe JAILLET --- /!\ Speculative /!\ This patch is based on analysis of the surrounding code and should be reviewed with care ! If the patch is wrong, maybe a comment in the code could explain why. /!\ Speculative /!\ --- drivers/base/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 3dff5037943e..854c1fab742c 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2107,7 +2107,8 @@ static int fw_devlink_create_devlink(struct device *con, fwnode_ancestor_init_without_drv(sup_handle)) { dev_dbg(con, "Not linking %pfwf - might never become dev\n", sup_handle); - return -EINVAL; + ret = -EINVAL; + goto out; } ret = -EAGAIN;