From patchwork Thu Apr 29 08:36:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12230781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B507C433B4 for ; Thu, 29 Apr 2021 08:38:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C869C6141E for ; Thu, 29 Apr 2021 08:38:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C869C6141E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5yJkiTJErVOayduR1xB9COvGe6eXd58otiWS91n3UgQ=; b=RRztROfBQ42izUbraxXWGWbwA nbkUfo1xB7gLW2kXKXwM3fuWRSh6lBX8nXuGE6pdWfhRQuPEUPYg4Y5LZ8dGqd9fE3uugKslH3DuS KykBBdMDPnxgXjWDJjB6MGRutP5l97F+YV7OfW50DtGxtfka0i5iTHvKpa3KAcjb+WBfP7NthfeP7 U/73dWeyUrCSIYMgFdBOV3wn8mhTSpoQXrvwQznDW+WAdQ6vd85RSj967vz4ISk6YNbCbxITCRUZO 7kKgYJCcR1MJjU7NZGtBhO5gbJluqqsijkOL5US3U4TqWnGBKeZgGjeJkFD/n8rEMfBny1B7NNeJA u8nByfbtg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AE-005KBD-UF; Thu, 29 Apr 2021 08:36:51 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AC-005KB4-GY for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 08:36:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=IYZf9Sj/B6q1uSGbdo4UoJLBuSfrW/IizBNvOD56C7M=; b=YeKZQyTR7rYfuX5xDWc3/my/jX KMUlJaFmu/Wi6dc2oDcXKqAAy2Gr8LiX4IeMZuON9mcTV698SJMWBoA1srzFxWfXl6Lb+cml7Y4Wd W6mYmuwXFWhwLgXGxA+Kpbb6t0K/JqfFStAjjBhMdTzgPJJKE6menV57BrToglUdX2tDnIWAcV4r6 ywxXpc4IVX/ggUnRv4POlEfqRbPq0PpTwFIAxXwDk5ObYAxfEP61tOYlL5EfavNYH7W7yAYP4FH6M V2BCkrfchvclU4HQTXwdAUxh5GkyEvS06SnWTcW9spicAqW7WNRmGx2Bk927xtkwy6Led4SGEpnZU nvHrmreA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2A9-000UYl-U0 for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 08:36:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 941AA61186; Thu, 29 Apr 2021 08:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619685404; bh=Q527VIq+GkpwCLejgbAK+745j3ug5PUj0Wy3UZuSaBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BA2K7uPPUo06DkGGdeG2QlunBOog1xiioiaPZ6qpA8wb8V9SCqQVykZJ4wr3Cg6J7 6kD6JSabGa42dpT3KR9nNAvvC0V5MvXZGPpoxc8h5kcrU7KBS/URZ8H2ywsxKcU0UI hwT5SBoYisskV+jeKJzgZaUKSefWAFgxwjrYpccD7QqiaEfINhy7bkdlvIJ9IWrrty xZFv5gmTou9Z8zG6LwsMHsmIcDHTuhetHKmAbRb0qq0DqfUWG4BLoh9HwwlUXUfhK/ qpe9a1LYMf/qlRE4R51TzK1NZMIc2xVUsLMafKBTz1DAag4UmhcCIZwCeMDNHtGnTg ql9XCu9to6+pw== Received: by pali.im (Postfix) id D757C7DF; Thu, 29 Apr 2021 10:36:41 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Gregory CLEMENT , Andrew Lunn Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 mvebu + mvebu/dt64 1/6] firmware: turris-mox-rwtm: fix reply status decoding function Date: Thu, 29 Apr 2021 10:36:31 +0200 Message-Id: <20210429083636.22560-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210308153703.23097-1-kabel@kernel.org> References: <20210308153703.23097-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_013646_052064_3792F539 X-CRM114-Status: GOOD ( 11.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Marek BehĂșn The status decoding function mox_get_status() currently contains a dead code path: if the error status is not MBOX_STS_SUCCESS, it always returns -EIO, so the comparison to MBOX_STS_FAIL is never executed and we don't get the actual error code sent by the firmware. Fix this. Signed-off-by: Marek BehĂșn Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") --- drivers/firmware/turris-mox-rwtm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index 62f0d1a5dd32..f85acdb3130c 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -147,11 +147,14 @@ MOX_ATTR_RO(pubkey, "%s\n", pubkey); static int mox_get_status(enum mbox_cmd cmd, u32 retval) { - if (MBOX_STS_CMD(retval) != cmd || - MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS) + if (MBOX_STS_CMD(retval) != cmd) return -EIO; else if (MBOX_STS_ERROR(retval) == MBOX_STS_FAIL) return -(int)MBOX_STS_VALUE(retval); + else if (MBOX_STS_ERROR(retval) == MBOX_STS_BADCMD) + return -ENOSYS; + else if (MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS) + return -EIO; else return MBOX_STS_VALUE(retval); }