From patchwork Thu May 6 09:07:57 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: 12241883 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.7 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 D8A45C433B4 for ; Thu, 6 May 2021 09:11:47 +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 429B86100A for ; Thu, 6 May 2021 09:11:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 429B86100A 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=UEx9QsgRFKQg2fI1hRFokzCL7xti7eLiH5MEcErUyJE=; b=Cl3pTzpbeG767TFqqTi6D35Wz I+WKBOZIy0rTZxmsssmOPc9CZ/QBTwOLYxQvcMgGraBSAh361/O6pFh6274CQ1J7xwVr2l9M0T0YK NgCuSgufhtsv92CuRJs/I/zTXbRsh0oL+lO7uXQ+fG9nLHHc5ZbwjosHxmG+lf6iZHa6/C6BDv8l8 Na8fOwsnmxyVJpPYItcr07UtGSii6w1yy8vo55lngiX6mQqBp1zGwqH8uEBSkzrDYJhULx9PTeI0D GGnUFglL2dFAB/Mmtw7QVf1eIZ+yvQmFsfv5OjMhWVZ3gZNffMLWjOq3PbY84HYG6XZ7hXEBtn9wt JGTD+dW6g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leZzt-003kpH-L4; Thu, 06 May 2021 09:08:41 +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 1leZzi-003koU-NY for linux-arm-kernel@desiato.infradead.org; Thu, 06 May 2021 09:08:37 +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=ESvRdpTeQZPcmmP68F2OVHIKrRjYZRm9K3JMn8lTZPU=; b=cGmz9+39PH1FxGsTTxxfR+eGKP gxLS0SxsZHxNPX6t89P2fSweAcLsnhX5qSPhTc2WDBrsfs8VJsK15QVcwFAYEPoGyHKhXwAQjoUmy iv/L8tCvHtusBdpRxV/SLFQK66MzaOdvuL1xm8hkJxS7QiusyuuN2kBwKEzh1viYGA7S7vbJ0cMUI MmgWJZWHA0Dpfh/Qbuz7rPQARsl9UNojncT/+Bkz1kGUF2fNURAA5J55JeSS4BUk7j9uRJ+a6OQSP qrVOw3xHHMLE6su6xSRWGpB7h89pGdrh4px2wzKzoE3MhD3cOEBDZlRWBfgiryt4Vn3zFC6Bz1uFG HAFLI1pQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leZzg-005tQZ-9g for linux-arm-kernel@lists.infradead.org; Thu, 06 May 2021 09:08:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6618360FEE; Thu, 6 May 2021 09:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620292107; bh=ORxyAXfPiELuOuNTDJqT+1syYGZTiHj3MDbntawW8/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GGL9D2IBAelQF9B7swdwg/1sg3Mx5qW14puHFL3uwBHHCT2umIdS2bWBPZZU5CYWt mNREd4nWAXphE6uFpiyt430ukAYgyCfFujEEeA8VOXhGslpVvQIlieT3Q17V0wu3nj b9dxwKOwWJTze6xx3vtZOBR3dvPqxRn/mZ3G8FYadYp+wEavaWD7G5nnQQUc0t1KHb 2mpAj9tFODF1G6R/hL3q4bsJoZAvyGlsoKTSR0xfkjgK33EVaNJvZ720lRi0TsoOyL KMa4o+hWU1ChpP1yzX6xNDj8XSp4HltiUxBLOG3arZFFZ3PEy4d8UyZqWC+gf5dZC7 fTngHZhTSZQ5g== Received: by pali.im (Postfix) id DAC3A732; Thu, 6 May 2021 11:08:24 +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 v3 mvebu + mvebu/dt64 1/6] firmware: turris-mox-rwtm: fix reply status decoding function Date: Thu, 6 May 2021 11:07:57 +0200 Message-Id: <20210506090802.14268-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-20210506_020828_392124_EDD9CD50 X-CRM114-Status: GOOD ( 11.76 ) 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 an incorrect check: 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") Reviewed-by: Andrew Lunn --- 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); }