From nobody Mon Jun 29 22:16:35 2026 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 F1819C433F5 for ; Wed, 2 Feb 2022 11:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244007AbiBBLgR (ORCPT ); Wed, 2 Feb 2022 06:36:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343899AbiBBLgL (ORCPT ); Wed, 2 Feb 2022 06:36:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA42C06173D; Wed, 2 Feb 2022 03:36:11 -0800 (PST) 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 13330B8307E; Wed, 2 Feb 2022 11:36:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC3C4C340EF; Wed, 2 Feb 2022 11:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643801767; bh=a1ae4CRR715CYUBaMy5Wvq7XIcUVZv3r/LRlFqiLhcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ACAYFu7lMBxzuwbdfNTStL40XCbFtT6GoVWnv4CP3EgQ/iOz+K6wOcHkZfBm4jv4W 8+OYs7ENFOzdKOVFFenKyHPBfotEK0CvcdAWhyJTUZUY3j+czBWz1T/wuIik2zCqAW 4GP37+mFhknWkybJEpIzfN11Jthh7wPR3RKWTebgsO+/IvpJO1cOkbdLMBTuozK45u pIlUpoqhbpD4X+r821bKC12WD9M/GJ+/j0iyqsHzmsVxy0uUYnzqlTztRoxkWyC2+1 O4Ylgk2bLhogace9pchPCSNE0w754rhmj74YrLYRFbIT4hu2tLqQAnEPZgADgp4/3G SctclROqzLPWQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1nFDvT-0000Lx-8Z; Wed, 02 Feb 2022 12:35:51 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Johan Hovold , Alex Elder , Mitchell Tasman , Dan Carpenter , greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/3] greybus: svc: fix an error handling bug in gb_svc_hello() Date: Wed, 2 Feb 2022 12:33:45 +0100 Message-Id: <20220202113347.1288-2-johan@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220202113347.1288-1-johan@kernel.org> References: <20220202113347.1288-1-johan@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter Cleanup if gb_svc_queue_deferred_request() fails. Fixes: ee2f2074fdb2 ("greybus: svc: reconfig APBridgeA-Switch link to handl= e required load") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20220202072016.GA6748@kili Cc: stable@vger.kernel.org # 4.9 [johan: fix commit summary prefix and rename label ] Signed-off-by: Johan Hovold --- drivers/greybus/svc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c index ce7740ef449b..51d0875a3480 100644 --- a/drivers/greybus/svc.c +++ b/drivers/greybus/svc.c @@ -866,8 +866,14 @@ static int gb_svc_hello(struct gb_operation *op) =20 gb_svc_debugfs_init(svc); =20 - return gb_svc_queue_deferred_request(op); + ret =3D gb_svc_queue_deferred_request(op); + if (ret) + goto err_remove_debugfs; + + return 0; =20 +err_remove_debugfs: + gb_svc_debugfs_exit(svc); err_unregister_device: gb_svc_watchdog_destroy(svc); device_del(&svc->dev); --=20 2.34.1 From nobody Mon Jun 29 22:16:35 2026 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 D9677C433EF for ; Wed, 2 Feb 2022 11:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343930AbiBBLgM (ORCPT ); Wed, 2 Feb 2022 06:36:12 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:46360 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245578AbiBBLgJ (ORCPT ); Wed, 2 Feb 2022 06:36:09 -0500 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 0828FB83092 for ; Wed, 2 Feb 2022 11:36:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE600C340F0; Wed, 2 Feb 2022 11:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643801767; bh=mQieYQKkKj2DTVG1ustfGTpy5JdAXgMiVkEJnFEOhjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KuEkAgjgVmPST/TCrjUN16vOXGT6aWlRPrByc3G+5md6qNHgYmXqHcSqkyDcXR5Qa xQcds3WB1XeFCe+oYNj+qlT4JRYIn4KTiKTREKUM6erVtbUAq8qpSDJmzUsybJudft Z3L5/Z+QjSXSKLyrf1i1rOgCtgYFS/Pmpa/FBqh+JAfJqd7MVP/j/kwTspNSLnBLtx Aexjz2tNeNxb3CWt1vRDqVSEYsCP/nNlPtb0ExHN36TfHgvtootACFlhb60sQFkFua +aQ+NPZX0eLPuRm2Wc8wuF1BbPsVc5nMUO99AhF+Vn+2CsYejaWUX1oMJBwvDv7sBZ v/PQebZAOYfvg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1nFDvT-0000Lz-BK; Wed, 02 Feb 2022 12:35:51 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Johan Hovold , Alex Elder , Mitchell Tasman , Dan Carpenter , greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] greybus: svc: clean up hello error path Date: Wed, 2 Feb 2022 12:33:46 +0100 Message-Id: <20220202113347.1288-3-johan@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220202113347.1288-1-johan@kernel.org> References: <20220202113347.1288-1-johan@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" While currently safe, it is unnecessary (and confusing) to try to destroy the watchdog when watchdog creation fails. Change the corresponding error path to only deregister the svc. Signed-off-by: Johan Hovold --- drivers/greybus/svc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c index 51d0875a3480..4f93d6b2f4ed 100644 --- a/drivers/greybus/svc.c +++ b/drivers/greybus/svc.c @@ -861,7 +861,7 @@ static int gb_svc_hello(struct gb_operation *op) ret =3D gb_svc_watchdog_create(svc); if (ret) { dev_err(&svc->dev, "failed to create watchdog: %d\n", ret); - goto err_unregister_device; + goto err_deregister_svc; } =20 gb_svc_debugfs_init(svc); @@ -874,9 +874,10 @@ static int gb_svc_hello(struct gb_operation *op) =20 err_remove_debugfs: gb_svc_debugfs_exit(svc); -err_unregister_device: gb_svc_watchdog_destroy(svc); +err_deregister_svc: device_del(&svc->dev); + return ret; } =20 --=20 2.34.1 From nobody Mon Jun 29 22:16:35 2026 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 0AA1DC433F5 for ; Wed, 2 Feb 2022 11:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343812AbiBBLgJ (ORCPT ); Wed, 2 Feb 2022 06:36:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231363AbiBBLgI (ORCPT ); Wed, 2 Feb 2022 06:36:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19A7C061714 for ; Wed, 2 Feb 2022 03:36:08 -0800 (PST) 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 56C3D616E3 for ; Wed, 2 Feb 2022 11:36:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6F07C004E1; Wed, 2 Feb 2022 11:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643801767; bh=UyZaJ0tB41ZV6qBFKK9qIgn5LBAmyc6MC+K+6DFNjjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Db18p5vr4c8W40fy+RORFCyNFR8aqxfBfI6Vy+ODBeUx/blR7PxB1PJ/iCWUVxnMb nxGC8BMUbjizY78IYE0jYgBs9+4BLCiwDSvBDdS6u2HikLWZeWflhd/DpPrvSAmoy8 Jy+Z9GTjuJs3bowDt9RVwduyGJvWIvrrOoi3q1ywlE7hhVYEkrQ8sKpepnQJIZQ7rC 3chnSUOFKc0juQIVvC6xOHzad8HVnhWGLdCErGjEfhzL5GH9yV7/YBjQoWYueKm5kn DhuoXjj6abIUFADblDBtaJg4mjp+mTSKf5wkBZYd9Ir5WCZvYe6MBiLlXAxvev8bRL JkpbnY/ZP4+JA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1nFDvT-0000M1-EE; Wed, 02 Feb 2022 12:35:51 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Johan Hovold , Alex Elder , Mitchell Tasman , Dan Carpenter , greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] greybus: svc: clean up link configuration hack at hello Date: Wed, 2 Feb 2022 12:33:47 +0100 Message-Id: <20220202113347.1288-4-johan@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220202113347.1288-1-johan@kernel.org> References: <20220202113347.1288-1-johan@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Commit ee2f2074fdb2 ("greybus: svc: reconfig APBridgeA-Switch link to handle required load") added a temporary hack which reconfigures the link at HELLO by abusing the deferred request processing mechanism. Restructure the HELLO request processing so that the link-configuration work is queued before creating the debugfs files and add a comment explaining why it's there. Signed-off-by: Johan Hovold --- drivers/greybus/svc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c index 4f93d6b2f4ed..56d2b44d6fef 100644 --- a/drivers/greybus/svc.c +++ b/drivers/greybus/svc.c @@ -864,16 +864,19 @@ static int gb_svc_hello(struct gb_operation *op) goto err_deregister_svc; } =20 - gb_svc_debugfs_init(svc); - + /* + * FIXME: This is a temporary hack to reconfigure the link at HELLO + * (which abuses the deferred request processing mechanism). + */ ret =3D gb_svc_queue_deferred_request(op); if (ret) - goto err_remove_debugfs; + goto err_destroy_watchdog; + + gb_svc_debugfs_init(svc); =20 return 0; =20 -err_remove_debugfs: - gb_svc_debugfs_exit(svc); +err_destroy_watchdog: gb_svc_watchdog_destroy(svc); err_deregister_svc: device_del(&svc->dev); --=20 2.34.1