Message ID | fb3a73fd378582bf02e6c5eeabb61d3a3662cbdc.1676453328.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp95548wrn; Wed, 15 Feb 2023 01:41:51 -0800 (PST) X-Google-Smtp-Source: AK7set8VctrwfBGlrQYD4ezwqMWs8jNteqkqUbj5HNKdHrbkzZa+Y0UeyhbSprYEDpSjFJSjyxqe X-Received: by 2002:a17:906:a409:b0:887:981:5f7c with SMTP id l9-20020a170906a40900b0088709815f7cmr1658482ejz.11.1676454111736; Wed, 15 Feb 2023 01:41:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676454111; cv=none; d=google.com; s=arc-20160816; b=J6omY+aNpocMumir/DKVORubS46nxH6k6XemgNQPx9VHDu/CKcQnxRdXR1+pVBi9eA xwrUynkeuhQRDuEqHNjnvGV7r14pbhvvVXj4fyBaguwKCV5pPUaF1qxrua3QCuljI71m wtHB3loMpSw8kKU3FrKVv59UfcU78WYYibPHxszhgeUkibMOMLdbyFHk3SWmU1sFa95X kBxsL6x6N/9yZzAMtDcwanRmPn6fWG+JzgYpjRLoP532T+Lh4b7iRzYBriAxt2Fjn0MP zxXTFdCT2BElsGXr2bHWL7kp6u6tmC3rf+i2ydG3XHLnOXWEaWbdSOBCYXA9FTCstNJz dfjQ== 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; bh=vsHp+vpmovpbGRRzG7MbeJ9grTWEXGZ/IxYgXUd67Zg=; b=YCCMtNi11jD2rugq/PUYO3Uj+AVpUmhY6a6uDXXoJsToy+DyUzxqYor+cFKDgDh3zY VimThdy4vUyR+zJNtKbafQahAsEb32/gBOJ984xc8xdsQX6F+UCWVGfW+RiqklrjkzJR 6WJGBRojgkK74F/2tC2dtV+MKisc4kdJhzjJJmfdzmVUFC95BPcPZ8zqoMLud73yCO8Y 7wLD3JSCEZOLUHXLvBG4jgVoXAfpRPwJ8q98cGPu98SFfCRWcqCwKvPYFqdTqdeu8W7K bUfhejlY4NhOWt0NMNO2IVvLKjwzXd+RmylPuGZwHmH5i5IxBZDY3mX8WpRbB27Hul0D oz+w== ARC-Authentication-Results: i=1; mx.google.com; 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 y30-20020a170906519e00b008b1329ec185si4120106ejk.786.2023.02.15.01.41.26; Wed, 15 Feb 2023 01:41:51 -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; 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 S233909AbjBOJaI (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Wed, 15 Feb 2023 04:30:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233914AbjBOJaG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Feb 2023 04:30:06 -0500 Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA70E93F7 for <linux-kernel@vger.kernel.org>; Wed, 15 Feb 2023 01:30:05 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id SE71pmycJOJaFSE71pRCYM; Wed, 15 Feb 2023 10:30:04 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 15 Feb 2023 10:30:04 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org>, Arnd Bergmann <arnd@arndb.de> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr> Subject: [PATCH v2] firmware: turris-mox-rwtm: Fix an error handling path in mox_get_board_info() Date: Wed, 15 Feb 2023 10:30:02 +0100 Message-Id: <fb3a73fd378582bf02e6c5eeabb61d3a3662cbdc.1676453328.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757888577074484825?= X-GMAIL-MSGID: =?utf-8?q?1757889546598615646?= |
Series |
[v2] firmware: turris-mox-rwtm: Fix an error handling path in mox_get_board_info()
|
|
Commit Message
Christophe JAILLET
Feb. 15, 2023, 9:30 a.m. UTC
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 <christophe.jaillet@wanadoo.fr>
---
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(-)
Comments
On Wed, 15 Feb 2023 10:30:02 +0100 Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > 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 <christophe.jaillet@wanadoo.fr> > --- > 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/turris-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 *rwtm) > return ret; > > ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > - if (ret < 0) > - return ret; > + if (ret == 0) > + return -ETIMEDOUT; > > ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); > if (ret == -ENODATA) { > @@ -236,8 +236,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) > return ret; > > ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > - if (ret < 0) > - return ret; > + if (ret == 0) > + return -ETIMEDOUT; > > ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); > if (ret == -ENODATA) { > @@ -275,8 +275,8 @@ static int check_get_random_support(struct mox_rwtm *rwtm) > return ret; > > ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > - if (ret < 0) > - return ret; > + if (ret == 0) > + return -ETIMEDOUT; > > return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); > } Reviewed-by: Marek Behún <kabel@kernel.org>
Le 17/02/2023 à 12:21, Marek Behún a écrit : > On Wed, 15 Feb 2023 10:30:02 +0100 > Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > >> 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 <christophe.jaillet@wanadoo.fr> >> --- >> 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/turris-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 *rwtm) >> return ret; >> >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); >> - if (ret < 0) >> - return ret; >> + if (ret == 0) >> + return -ETIMEDOUT; >> >> ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); >> if (ret == -ENODATA) { >> @@ -236,8 +236,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) >> return ret; >> >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); >> - if (ret < 0) >> - return ret; >> + if (ret == 0) >> + return -ETIMEDOUT; >> >> ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); >> if (ret == -ENODATA) { >> @@ -275,8 +275,8 @@ static int check_get_random_support(struct mox_rwtm *rwtm) >> return ret; >> >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); >> - if (ret < 0) >> - return ret; >> + if (ret == 0) >> + return -ETIMEDOUT; >> >> return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); >> } > > Reviewed-by: Marek Behún <kabel@kernel.org> > Hi, polite reminder. CJ
Gregory, could you take this patch via mvebu? On Tue, 11 Jul 2023 18:44:36 +0200 Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > Le 17/02/2023 à 12:21, Marek Behún a écrit : > > On Wed, 15 Feb 2023 10:30:02 +0100 > > Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > > > >> 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 <christophe.jaillet@wanadoo.fr> > >> --- > >> 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/turris-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 *rwtm) > >> return ret; > >> > >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > >> - if (ret < 0) > >> - return ret; > >> + if (ret == 0) > >> + return -ETIMEDOUT; > >> > >> ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); > >> if (ret == -ENODATA) { > >> @@ -236,8 +236,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) > >> return ret; > >> > >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > >> - if (ret < 0) > >> - return ret; > >> + if (ret == 0) > >> + return -ETIMEDOUT; > >> > >> ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); > >> if (ret == -ENODATA) { > >> @@ -275,8 +275,8 @@ static int check_get_random_support(struct mox_rwtm *rwtm) > >> return ret; > >> > >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); > >> - if (ret < 0) > >> - return ret; > >> + if (ret == 0) > >> + return -ETIMEDOUT; > >> > >> return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); > >> } > > > > Reviewed-by: Marek Behún <kabel@kernel.org> > > > > Hi, > polite reminder. > > CJ
Marek Behún <kabel@kernel.org> writes: > Gregory, could you take this patch via mvebu? Yes sure, actually I was not in CC of this series and I don't follow linux-kernel or kernel-janitors mailing lists. So thanks to having pointing me the thread. Applied on mvebu/drivers Thanks, Gregory > > On Tue, 11 Jul 2023 18:44:36 +0200 > Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > >> Le 17/02/2023 à 12:21, Marek Behún a écrit : >> > On Wed, 15 Feb 2023 10:30:02 +0100 >> > Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: >> > >> >> 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 <christophe.jaillet@wanadoo.fr> >> >> --- >> >> 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/turris-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 *rwtm) >> >> return ret; >> >> >> >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); >> >> - if (ret < 0) >> >> - return ret; >> >> + if (ret == 0) >> >> + return -ETIMEDOUT; >> >> >> >> ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); >> >> if (ret == -ENODATA) { >> >> @@ -236,8 +236,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) >> >> return ret; >> >> >> >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); >> >> - if (ret < 0) >> >> - return ret; >> >> + if (ret == 0) >> >> + return -ETIMEDOUT; >> >> >> >> ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); >> >> if (ret == -ENODATA) { >> >> @@ -275,8 +275,8 @@ static int check_get_random_support(struct mox_rwtm *rwtm) >> >> return ret; >> >> >> >> ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); >> >> - if (ret < 0) >> >> - return ret; >> >> + if (ret == 0) >> >> + return -ETIMEDOUT; >> >> >> >> return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); >> >> } >> > >> > Reviewed-by: Marek Behún <kabel@kernel.org> >> > >> >> Hi, >> polite reminder. >> >> CJ >
diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-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 *rwtm) return ret; ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); - if (ret < 0) - return ret; + if (ret == 0) + return -ETIMEDOUT; ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); if (ret == -ENODATA) { @@ -236,8 +236,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) return ret; ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); - if (ret < 0) - return ret; + if (ret == 0) + return -ETIMEDOUT; ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); if (ret == -ENODATA) { @@ -275,8 +275,8 @@ static int check_get_random_support(struct mox_rwtm *rwtm) return ret; ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); - if (ret < 0) - return ret; + if (ret == 0) + return -ETIMEDOUT; return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); }