Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp463441pxb; Thu, 9 Sep 2021 05:10:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySfaZlk7tK1aS0QkI7cg4izg2uD2AWGcamG3bG1g2yBbD/NmuuNgvmtfGUnrhsjZ7aIyLE X-Received: by 2002:a1c:7dd0:: with SMTP id y199mr2633718wmc.23.1631189404216; Thu, 09 Sep 2021 05:10:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189404; cv=none; d=google.com; s=arc-20160816; b=dA0+VnwWZwJcQOwwp9KJROc0UdpHyCVa9ttKuUt3h4RI2fhMWPg36codNdzMI0+w+I my5wNqHiGMBpCe0Jiuoxsj6H/HpeMsa62KR408J3MW2UEX7hPqDLwOhENBZVoCNmgdxe Jfwu3EJg8vAXyvyfz7YmG1OeYsbPmPXK4qSuijoDhwb6Pc5JLJ34aZ/BkPhbIRoXX+Dv vCBEgmfc3s426alhLbdMxG0j2BTEwSx7uf4CvDDEuazTE00Cy6H31BNQL3uCXQ+LOZ1j sJ0oc/oIElAw3Z25AnyWhTVeQf9RyhVfjxZtdflMQS0S3/7Zqo4knIMyef38Z59BJ+// M5ow== 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=5rbbr3RyH7iNe5+ByjLf0S27o2UpYiJOjbw1TxS1Fdw=; b=PonjlrinkDLx3+6pDTm8FB5FB+/zZyFjUUWtPnAg4hKmtQVFFZBvImIcbFTQOzmY/g LoUjJDq2qSBagbEUIOwqEU0ALirrKwM3UR5JlnQ1HbDd1nFZozc4hVFi00EzqN6XvnYn aOGNJ4wYn2tdvVjwK8ZsVKsMOhWjMTj0tjHy3iEJSbqBg7KcqMjtwNhOUJ8wzphpYTPl K2P+T1G/05CepzgeWD0Fcr8PXSNAp4c/AyamZJrTp+41jawqygrxYRr6Lvv2NmqS9kpP WzLNMzbXvYq0QJe35jkwS8Iq7w5d304h2uEadf9xMj+MwmsgrIUqC+bv5Ba5WKkkHie2 X0Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZkJsnlty; 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 k24si1777063edv.610.2021.09.09.05.09.37; Thu, 09 Sep 2021 05:10:04 -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=ZkJsnlty; 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 S1346796AbhIIMHh (ORCPT + 99 others); Thu, 9 Sep 2021 08:07:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:42000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344551AbhIIMCU (ORCPT ); Thu, 9 Sep 2021 08:02:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABA746142A; Thu, 9 Sep 2021 11:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187993; bh=p+dPIwG9V9V2zwpdYIFOMjTOYuq6U/cMiuAugfdolhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkJsnltyG1pvlHvAjcb3yuSIydpRBt3jGiVBb7EqTHomoDd5ecY3pvbApBqknM+tj KCfh7j4qPqav0wrtvLimJ8/q8Pmfc0Zy/n+Z1ymQDpKQ0RaEjTPP7nqe7EAR9PhUmn WN1PrufqpsYSCTxgDc69jhx7MXkwgQtk3mIYyTMn9L6Kq6apiye77VjAM4MVN4BbaX b5S7dq+dTxWnG/HG5YjPmH3CRR3rJSwzaJsk9VJkdMZhc+kkmWGvA2um80eRaiN4Ev 7P3H9nl4qGUNH5CLJxGwwgOTuIHXdr3jhtFfT/EXzBEiWbDQLBFeELgHO8lmtSobUi hYK3KRgIUEH7w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Guojia Liao , Guangbin Huang , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 252/252] net: hns3: clean up a type mismatch warning Date: Thu, 9 Sep 2021 07:41:06 -0400 Message-Id: <20210909114106.141462-252-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guojia Liao [ Upstream commit e79c0e324b011b0288cd411a5b53870a7730f163 ] abs() returns signed long, which could not convert the type as unsigned, and it may cause a mismatch type warning from static tools. To fix it, this patch uses an variable to save the abs()'s result and does a explicit conversion. Signed-off-by: Guojia Liao Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index c0a478ae9583..0dbed35645ed 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -10,7 +10,14 @@ static u16 hclge_errno_to_resp(int errno) { - return abs(errno); + int resp = abs(errno); + + /* The status for pf to vf msg cmd is u16, constrainted by HW. + * We need to keep the same type with it. + * The intput errno is the stander error code, it's safely to + * use a u16 to store the abs(errno). + */ + return (u16)resp; } /* hclge_gen_resp_to_vf: used to generate a synchronous response to VF when PF -- 2.30.2