From patchwork Wed Feb 15 09:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 57444 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp90385wrn; Wed, 15 Feb 2023 01:26:27 -0800 (PST) X-Google-Smtp-Source: AK7set82LxxA+xBTkQAhQ+2ie/0c9m661kgRgrLYjbJgfH+YmPLpXNliFThBHsmRYKBrwvEHug1u X-Received: by 2002:a05:6a20:6992:b0:be:e0c3:5012 with SMTP id t18-20020a056a20699200b000bee0c35012mr2183189pzk.1.1676453187077; Wed, 15 Feb 2023 01:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676453187; cv=none; d=google.com; s=arc-20160816; b=GZekE0N3fgbHmKsfwZ4LCdh/YWUWC8QMmb1PPChU4GFRFQ0elM3iNBJjhwt4ASfpMz tY6JD9tHOzyh2epsx/wvcYoXjyvhygRIlToaV8PWBtdKkz1dmn7RGpvcPGAWgwuxnwuS 2sc0rR4aOXwW8N6O+OKrqgXtOXa4RnU85aXSiYFLnigzZtGLuDwPUBAdhj8ky80OHZoD 2MPUZ25XYJ9STadPAMpXKu9Z53Wx/DX+KP7PcbC6wBzyeZXYJG7VNvyYdXTQ/VMA0AMq A6Nz39W7h1Gj2wMO+x0zC0XsgH6lHu/W9Hsg+eqVUSjhLmWIVfnIZeWtEzsfKViOwiTk QkhQ== 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=BxbH+4bB7HMDv2iW5WXQEx7TbgTRyioXsKxbyLpc7/Q=; b=JtB4kPw6rvxXEGqhEBMnU6dIeXbj+mPd7qiEt/in1eG7A2tG1HdONpLj1xjuhrRuS8 Hkbbyo29rNQbbklg1BCHopq1T6TfB+pNaqEr6unFGLy1iRKRVh14K3n8Jt6FsryFMJ9P L3Dn4gSnkiZ/vw0NNmKssINVNLoTCIGqPttjxpnKpNlsuISpcCEHTanbJDHs8VIlcQ5F Z6OCje4lsJQWLsgpZnGG2sftaQLm6HZysZO8ElEp44McRbeKEVrw+Ha8FoonCT2OAnsh f7emorDg1d85N7cbkfF+IwRcX/N7jAWvsJ9yn2qXz2F4ZRhYN6vYZhJS/4ReEefkIoxF qIEA== 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 q17-20020a639811000000b0049de6ef731bsi16661872pgd.340.2023.02.15.01.26.14; Wed, 15 Feb 2023 01:26:27 -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 S231253AbjBOJU6 (ORCPT + 99 others); Wed, 15 Feb 2023 04:20:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjBOJU5 (ORCPT ); Wed, 15 Feb 2023 04:20:57 -0500 Received: from smtp.smtpout.orange.fr (smtp-20.smtpout.orange.fr [80.12.242.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B15E27A9F for ; Wed, 15 Feb 2023 01:20:55 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id SDy8pGKTcPma6SDy8pv2OJ; Wed, 15 Feb 2023 10:20:53 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 15 Feb 2023 10:20:53 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: =?utf-8?q?Marek_Beh=C3=BAn?= , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] firmware: turris-mox-rwtm: Fix an error handling path in mox_get_board_info() Date: Wed, 15 Feb 2023 10:20:49 +0100 Message-Id: <60b29f04b47a60ae6da754034a608aae1eba053a.1676452827.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757888577074484825?= X-GMAIL-MSGID: =?utf-8?q?1757888577074484825?= 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. --- drivers/firmware/turris-mox-rwtm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index 6ea5789a89e2..577e87e1c6ee 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) {