Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3854483pxv; Mon, 19 Jul 2021 10:19:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0/MKI52EDSgriydEK6/wpjmpId/0BCYEqowvkUbHq91F7HCs2XB3DxcOj+PIvli86XLTL X-Received: by 2002:aa7:db94:: with SMTP id u20mr35851548edt.381.1626715149947; Mon, 19 Jul 2021 10:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626715149; cv=none; d=google.com; s=arc-20160816; b=FUFQNH5dRVzrBwSiEPaxUkrW/4Om8aU/r0jc81ZzctOsEa4qjSdv+AMudQGb/v1QPh cXmAaTnaN15ZxSX1s/9rLBoTffgdvNDb8XBgBGlwHAgI2PIR1A7ceDaR7WA1fCwPy8G4 +uj2lYESmmnp3qqDfzL9NqF1lkT9Tx0DISFr81BH3wtWUdkSCOR1wsq4B9QEmpjtT7cM gpr4o/XGJiqtsh6bm23923WAgrGj67BRTxsPdG6Xu129xAWq4d2yQFTB56/5i7sx6R7t h/BZmh2hBhXfv9kGwGLVnzqs+JoVXsWHUHs7O4cpWRGQ5adN1IbN1DbMXBAxxnUsFHnu pW5g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y8GHg46IosGp7yIh9MzqOohAPySFBvt4EphMmjcIXkY=; b=uesyVqXvcnDW97YA8bMsoAcV2T7LirwztE5YrIpC2sl26zkBls42NrkiB7pJKJgEsn rt9yk+5rJHVqsPdaIKgKh9/b4InkWM8WCJgcJE6iLA1m2R7WXKhBbFJDG+zYEHDFzXSR A0ZbBYZ939Os2HINaLwB0rFgIpPuK5GMgx5QNNiPJzTTM4WUy203+dOqm005Z0g12QBk iMYFfc/Ox6fqglYNVLhkiIfBtuDmOV431tWtkq4cKYtvZ5plcA4Si0fNVRsuB5xTffYp f95bzcjqwLlk1ogoCp3scfEfGsKmysXUlC5EQmXmo5ogawX35vitp3dxMWEeKwNCRSyh /uXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ir3TOjVZ; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh9si26063210ejb.525.2021.07.19.10.18.45; Mon, 19 Jul 2021 10:19:09 -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=@linuxfoundation.org header.s=korg header.b=ir3TOjVZ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355410AbhGSQgS (ORCPT + 99 others); Mon, 19 Jul 2021 12:36:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:38042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348058AbhGSPYd (ORCPT ); Mon, 19 Jul 2021 11:24:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9572C61400; Mon, 19 Jul 2021 16:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626710466; bh=LXNf/PvxCA1IwUCmIfU/z06fCS9WB2SZQ5H1ZYZ3i6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ir3TOjVZ4rk8tzGD9DyBxif8Gl9q9vTlMq1XSrmX80Q+gCv1zir2eq6Fd91BJASvd r7C3zTkvRr6cb9U071aZ+Pe46nY7jXoxfnzEbXzSEljx7k+0Ebc937sUeRQGT2/Sta RY+hOVe5/gF1xUyBzUKEg5yNFh8hbFs0eFnFlZms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Andrew Lunn , Gregory CLEMENT , Sasha Levin Subject: [PATCH 5.10 229/243] firmware: turris-mox-rwtm: fix reply status decoding function Date: Mon, 19 Jul 2021 16:54:18 +0200 Message-Id: <20210719144948.312268276@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144940.904087935@linuxfoundation.org> References: <20210719144940.904087935@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit e34e60253d9272311831daed8a2d967cf80ca3dc ] 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 Reviewed-by: Pali Rohár Reviewed-by: Andrew Lunn Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- 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 50bb2a6d6ccf..54b98642ee1b 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.30.2