Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38241583rwd; Wed, 12 Jul 2023 05:15:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEZvhxRi9ld4z07t0jVz8YFTle74K4n4Z4yCvjOlE8GDAVnWR087Z1I6Ys1KzBfgsal487m X-Received: by 2002:a17:907:1390:b0:992:8092:c109 with SMTP id vs16-20020a170907139000b009928092c109mr17254867ejb.51.1689164108576; Wed, 12 Jul 2023 05:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689164108; cv=none; d=google.com; s=arc-20160816; b=dk4TMYmVvJHoRgmCjBkW2J2WoalH71EGuRGhVdMWqt+hf27ymYiwMPNW/QQVFaUCWC 1adV/IQVWs61xEpa0LnhuqOCJU0dy/hJJsYG4of79CXuQHegYpP0mY6Jyqoi8HZY+12A xnL/e15p+7MLzYzf1fb1Bm9xC2CS7s86M6BRayTY+YlBh5cLD01FGZjyGH3kp8NKsbb2 FnHNrs9Wj455tGL0RhU9Q1pU5SDSSsvtnF8sfK7hrQ0dS6V7rGzUtIhmMSWfSBc1Ov6h bNPt6k1ng+d+2sOrmO1Mb+cg8XFMMgwASGGnL3VGPhm1674T/PvXTEwnODwt0mEcIi7o W4nw== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Su/cMUeGduB8P+BEN/lB0IquJOrkqorBjwHN3PVgeNw=; fh=oPpl9dc+KZAsKaMZAbpcMibGU2w3Jyrte2AgHn29xN0=; b=BfcWntiNAcSZGuxsPwM+vY/u37PHte1SngwxdnDxS39VfDF0qMKmO4xLH4AcWTGg67 euKi7dd1GK5cJQv3z333KcqdSTg0l5FVL5oAj+0o7BelGqlKnKwB5xTsIuylBC2IIf0d E7n0R2pOBxI6nirx1nGjCYk5agVEq7mDyj8uSoQUgcbA0RMlvuZEw4HIxoc2Xc9Llnrk xaWOgnFsduSbbpb4y1hkZBTroTpGzZi545mS5gV7/8cmKFTQDSInlccf1UTH8sphxC3k YNipU+bWEbJLhW1VfJMD0GucwUxYytXgfF8wZw94BuSqtVOyqcvN7JeuodtEnJ19lhSb SbAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p4rcN99w; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a1709063e0900b009875f181d5fsi4584442eji.821.2023.07.12.05.14.43; Wed, 12 Jul 2023 05:15:08 -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=@kernel.org header.s=k20201202 header.b=p4rcN99w; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233059AbjGLLRB (ORCPT + 99 others); Wed, 12 Jul 2023 07:17:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233116AbjGLLQj (ORCPT ); Wed, 12 Jul 2023 07:16:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93D6A1BE3; Wed, 12 Jul 2023 04:16:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A173F61779; Wed, 12 Jul 2023 11:16:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13848C433CA; Wed, 12 Jul 2023 11:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689160594; bh=z8wYXBpvPqezW8+Aq12OFGkmP7PrH5hpc2JqCK5G+Jw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=p4rcN99w7Je7qXSskRXrngQQtbuPRJ8HBrbc3/nEma0tiACwf2Qfgf1zeDn7c2eBw QOfzb+we6L80q1bWA7symXmUz8lqO2a8HkOVo8po7xdC1cnrRmL+CIk6MFndtXklv/ pIJ/LQ0pzwM81pQ3wOKtK/c64fkMM4P5u1mJ4CNWdCD/pJDbW2WfAOmdNCMCznvE7I 5pULZlOqgiLSPwIz9gczv0ztU05BvHpQeVnrXwtKHnVB4LHMRXaIqiYEDrxOmREEW1 ZduUu2KS0YJI328fXM/YU6xXsoEFHKpP7RYNW01yODzcj1p7Gjgqi/Jr7hTByLHYzb wyt17TGArCQQQ== Date: Wed, 12 Jul 2023 13:16:29 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: =?UTF-8?B?R3LDqWdvcnk=?= Clement Cc: Christophe JAILLET , Arnd Bergmann , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v2] firmware: turris-mox-rwtm: Fix an error handling path in mox_get_board_info() Message-ID: <20230712131629.3161d6c9@thinkpad> In-Reply-To: <95bd5686-1ed9-63ef-e91f-30aa54c09cd6@wanadoo.fr> References: <20230217122108.4a93667f@dellmb> <95bd5686-1ed9-63ef-e91f-30aa54c09cd6@wanadoo.fr> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Gregory, could you take this patch via mvebu? On Tue, 11 Jul 2023 18:44:36 +0200 Christophe JAILLET wrote: > Le 17/02/2023 =C3=A0 12:21, Marek Beh=C3=BAn a =C3=A9crit=C2=A0: > > On Wed, 15 Feb 2023 10:30:02 +0100 > > Christophe JAILLET wrote: > > =20 > >> wait_for_completion_timeout() returns 0 if timed out, and positive (at > >> least 1, or number of jiffies left till timeout) if completed. > >> > >> In case of timeout, return -ETIMEDOUT. > >> > >> Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") > >> Signed-off-by: Christophe JAILLET > >> --- > >> Compile tested only. > >> > >> v2: > >> - Fix some other wait_for_completion_timeout() calls > >> > >> --- > >> drivers/firmware/turris-mox-rwtm.c | 12 ++++++------ > >> 1 file changed, 6 insertions(+), 6 deletions(-) > >> > >> diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/tur= ris-mox-rwtm.c > >> index 6ea5789a89e2..d6fc37ba897d 100644 > >> --- a/drivers/firmware/turris-mox-rwtm.c > >> +++ b/drivers/firmware/turris-mox-rwtm.c > >> @@ -200,8 +200,8 @@ static int mox_get_board_info(struct mox_rwtm *rwt= m) > >> return ret; > >> =20 > >> ret =3D wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > >> - if (ret < 0) > >> - return ret; > >> + if (ret =3D=3D 0) > >> + return -ETIMEDOUT; > >> =20 > >> ret =3D mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); > >> if (ret =3D=3D -ENODATA) { > >> @@ -236,8 +236,8 @@ static int mox_get_board_info(struct mox_rwtm *rwt= m) > >> return ret; > >> =20 > >> ret =3D wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > >> - if (ret < 0) > >> - return ret; > >> + if (ret =3D=3D 0) > >> + return -ETIMEDOUT; > >> =20 > >> ret =3D mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); > >> if (ret =3D=3D -ENODATA) { > >> @@ -275,8 +275,8 @@ static int check_get_random_support(struct mox_rwt= m *rwtm) > >> return ret; > >> =20 > >> ret =3D wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > >> - if (ret < 0) > >> - return ret; > >> + if (ret =3D=3D 0) > >> + return -ETIMEDOUT; > >> =20 > >> return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); > >> } =20 > >=20 > > Reviewed-by: Marek Beh=C3=BAn > > =20 >=20 > Hi, > polite reminder. >=20 > CJ