Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37137321rwd; Tue, 11 Jul 2023 09:55:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlHnJz6VeZ8wQkarlIGNtaGYCfEMpUYG4EjGk47Bw4CdxrJu227bB55kneL9zLqtociHqdsB X-Received: by 2002:a05:6a00:21ca:b0:666:e42c:d5fb with SMTP id t10-20020a056a0021ca00b00666e42cd5fbmr21346450pfj.32.1689094509249; Tue, 11 Jul 2023 09:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689094509; cv=none; d=google.com; s=arc-20160816; b=p3ahZBSHUaJs7kaEgV88GAWxIqQ16cFPDyWkGbgYFCO+OCp4K8GRM0KF9aS0GlD8BK wyAUreV/m/t3lyzNZLFumu0bK33SKxcfBgi40QR8bifa+AbPs5qmj7tH1y4JeBOBK/3E SyekdusmScBNmEUBRiO6j7TSiqaA9mqj/3jDKQCroXTfzZbvDAYi4jYmRonazZhXZ4/E Rc9B0rG5vhG7TN8zY6xEBNP9E2WwXLUFCmeMs/yOBxNEqVaBjpGCBKG3ebjr5L4RAT+7 IIrRsBiOnhuBKnTC2WX3S6y/4DB8adnzpbYImyfxwt0HEbgyTQhPH0k0vaZvEqvgVloo yn0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6W5NPMxAm6lUBSA+tofYioXnHuavxBdyj7tIJCVWBDg=; fh=XlCrTU5kshosWfU1tuRydWHdlU2Hbj4nd3KBY+StxCs=; b=VNng9uSC5HiPKmbj5mogXQJgEKV7kGWzyu6zIGxqrxwy3G0hL1dA59+t3fk1EMACwh 6vWh4em+kNN1eFlmcJxGe0mG5VeF8y+OpfXzxam0Ddx/QX+Zb+z+1kX6en8ow2JAm+3T VAJPvtuYaHpa8pIH5q2jOdKBQ5bgu9FqCFs++M60Gz51YjkGizLnqTf8uBwC33bR15PG iwuIf4LZhRh2HEEtMz/zcbwYqwzNFUzoIJALSE/jyCptozWrrHNV3HjS9AUzuVcEj8I8 32GhGcip0mYHo96HAzzTstF1j7H1bhs89umQUrRhxnFcznr0ui7P4Gi29gF744rA0rJR HgNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=jSsfs6Al; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 85-20020a621958000000b006826c5b86dasi1703033pfz.364.2023.07.11.09.54.45; Tue, 11 Jul 2023 09:55:09 -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=jSsfs6Al; 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 S233034AbjGKQqS (ORCPT + 99 others); Tue, 11 Jul 2023 12:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231886AbjGKQpx (ORCPT ); Tue, 11 Jul 2023 12:45:53 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF43B1731 for ; Tue, 11 Jul 2023 09:45:03 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id JGTcq56F0nT3LJGTdqAYmw; Tue, 11 Jul 2023 18:44:38 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1689093878; bh=6W5NPMxAm6lUBSA+tofYioXnHuavxBdyj7tIJCVWBDg=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=jSsfs6Al0SzL4B24SF7Cz1+iYxRlmMNO61eyQS56UCRt9wwE7zalBZgedAFs/woZi 5LiCnuH7OvVHQzRXtF1Q0UFZWVekh+zaE0yqmJxEK3mDtdhV72kwr0EtsQ//boPYGO zq6t0LospEKd0q+1pAeFY76l7c5WrdARDZnW/XK61c4bHVW3Ls9ksHvtzk8KFKCZ9E Y7Qv9VRemzr79ya6nvif75Wf29bSWPPIe/EezAOGMV5jYnBCNWDDyivxXbIXHb0A+A gWKkG+0wkprmNWJs8w72ah0ri675o+BT5iIKtGoDxsnCivovlC5hrIRBjFBikdVmRz /xz0huZg9+lBw== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 11 Jul 2023 18:44:38 +0200 X-ME-IP: 86.243.2.178 Message-ID: <95bd5686-1ed9-63ef-e91f-30aa54c09cd6@wanadoo.fr> Date: Tue, 11 Jul 2023 18:44:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2] firmware: turris-mox-rwtm: Fix an error handling path in mox_get_board_info() Content-Language: fr, en-US To: =?UTF-8?Q?Marek_Beh=c3=ban?= Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20230217122108.4a93667f@dellmb> From: Christophe JAILLET In-Reply-To: <20230217122108.4a93667f@dellmb> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,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 Le 17/02/2023 à 12:21, Marek Behún a écrit : > On Wed, 15 Feb 2023 10:30:02 +0100 > Christophe JAILLET 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 >> --- >> 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 > Hi, polite reminder. CJ