Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1197933pxy; Thu, 29 Apr 2021 01:38:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAqANbdQDojmi43kcFezLisy7pvQdbN8l7HcOGGPnDCTXGhysyaR8VX5by/eOE1zByY1cD X-Received: by 2002:a05:6402:48c:: with SMTP id k12mr16969156edv.237.1619685492119; Thu, 29 Apr 2021 01:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619685492; cv=none; d=google.com; s=arc-20160816; b=Ep/Dwo/eGdoX07HOOcUIkv0cc/eQ9RFRWelPL9IpTTA6v2eICSUCODT38VmBXdaqo6 HzqY3myKgxOMf7r434b+UBylPC6xqjTe1pJ/ilYp2gAbq5SIAOvcJ9h3smEhvljh1LFH x2rx4NRtNGGcwaj2uh9eBDaW7c17QC7tqPG5P6rD4SSk2zcKYykXuEAOkmprMhuNFASB u8cRdAdEUNpP57xFno7IB5utls2/Av/m5SoYMAfBQQRR0w26Jj7X0r8nxDyuHUETJTs8 hVZ/CxIt6mT/crLIQZux5eYjLOJH5jsHMa1jM1xFGLD+b91AmR/qFdOE+gTqYx3UeQ93 z6vw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IYZf9Sj/B6q1uSGbdo4UoJLBuSfrW/IizBNvOD56C7M=; b=ieosXm0x3SLcZlaBbWgWBPC0eKYavr5npA+qjv3O7oaSwhyLL6swuWhe0MAlA74XcF wK/aIxYoes3xsO+aNEncddV45spn0ZDb4FiTLd+U/6SDTt85qkzdwNSrwKbqEOQHvauT jQ9zDH2/edm2DzpqLdjMQ5WETUNQHnONwX+NPxByGVNrfrc+ph5MerxeUvECMVvClPwQ yvgb6w6aEen3UEaNI2CPTG9ePbwmqLzdxlpCJoyXlufZ+iO+Fmdrt/7z9x987wmt3DjZ SMLk0qP0LyE8Z4ve/rRaDwU4yCYDNWxLWLIL/71t/eAKnnRcrIP89Yu6a4ColwDcR44j kvVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BA2K7uPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y22si225491edr.245.2021.04.29.01.37.46; Thu, 29 Apr 2021 01:38:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BA2K7uPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239730AbhD2Ihc (ORCPT + 99 others); Thu, 29 Apr 2021 04:37:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:47754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbhD2Ihb (ORCPT ); Thu, 29 Apr 2021 04:37:31 -0400 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=20Roh=C3=A1r?= To: Gregory CLEMENT , Andrew Lunn Cc: =?UTF-8?q?Marek=20Beh=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); } -- 2.20.1