Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp479727pxj; Tue, 18 May 2021 07:39:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+ySwN1NriRYUqn6bHvd1B4S6iRxKTwTwPazDvF7JbnLNiF5eMl0iWXQ2pS47Efs0+jC3R X-Received: by 2002:a17:906:b288:: with SMTP id q8mr6410738ejz.524.1621348762401; Tue, 18 May 2021 07:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621348762; cv=none; d=google.com; s=arc-20160816; b=t7bmMxHoplElU4jWkB+9/lyN8joe7PbSz7/fSXtGSViSImHxrX+jSPPXuKq7KZ4Htb W5E7CMHMtB2gJiJIyMmOXxD70H6VVudawd09esbuG8J2uVqGK/yeqp/3uoA/zzUWjAN/ 0B8XD43G5BJO+thtmlzI2EjGpeUkf4teXsSU4fc515MWipShlwAnHPL0lrtkl1fjmysr yiXcc6Vola31CBMmD2BIQEd8zfulRSctCX88QZBoqzyga7At59FPxagy7qUXc27oOCWT TwqjJ2pTWxnsfFWFMnweFFks7S5wuvB9NSwN0KvGh1PmC0j+ziWXWSIZSBlFdTMB63hr 8ONw== 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=oDHb8fjpU1ndqbmW0xBJ//6rkZzhxxqyy++4vWIYg1w=; b=kvP4J2zi1tkupE3ASWP9DeE9+runshywoqZ+Sw6df8Wy5tk8dT4qfwGYwttl8Pal9S 9KK2QAINJv21mlWTKoHq7HTemtidHSTGx+45kfO+r/KzfH/dLn6LxfOV7oiEqhF/yM9+ DIMM6WSYI5WoHu/5ziKTNLJoObeLjxb/0f/fjDjSi6a3FOGuCCzrSKvTvJQnIaNsm8Jl EC3wXcnq0X9/VqkWVlHdSh89KtcpEfygRH850v8JmmKAWvhXL1AApvY2LPz3r2WU+Zn1 0Lrce8h6Kg84TbbA4j94nxEP3bwZ8G+Lv19RAIYEXG0ndbvlRn2UFvBQyLA5S6GxM+kf y2cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XT1JdDgo; 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 g2si18325944ejk.687.2021.05.18.07.38.58; Tue, 18 May 2021 07:39:22 -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=XT1JdDgo; 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 S1343875AbhEQPqR (ORCPT + 99 others); Mon, 17 May 2021 11:46:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:55332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245710AbhEQPak (ORCPT ); Mon, 17 May 2021 11:30:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0BDEA61CC8; Mon, 17 May 2021 14:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262280; bh=yb2t9n9d73ncxUe8UzTCxpoOQfoZZe3tejDhEVDgH2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XT1JdDgo9VFrP37EYtcOyXlfW1MKLEJl9AyHcNjqO6VS3+hp1IMwGz8eXuaao2TN1 DHL7BekvmCLhtZ9ZQoKPBsl7Lm34QJZ9dA3u+u1Z2TIhbG/f7HeiFO/dZqKxmaAoSx jHCR2PRJJmo4P6mBJUJmKk8mpos1FD8mcuH7eSoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anup Patel , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.10 152/289] RISC-V: Fix error code returned by riscv_hartid_to_cpuid() Date: Mon, 17 May 2021 16:01:17 +0200 Message-Id: <20210517140310.263298172@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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: Anup Patel [ Upstream commit 533b4f3a789d49574e7ae0f6ececed153f651f97 ] We should return a negative error code upon failure in riscv_hartid_to_cpuid() instead of NR_CPUS. This is also aligned with all uses of riscv_hartid_to_cpuid() which expect negative error code upon failure. Fixes: 6825c7a80f18 ("RISC-V: Add logical CPU indexing for RISC-V") Fixes: f99fb607fb2b ("RISC-V: Use Linux logical CPU number instead of hartid") Signed-off-by: Anup Patel Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- arch/riscv/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index ea028d9e0d24..d44567490d91 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -54,7 +54,7 @@ int riscv_hartid_to_cpuid(int hartid) return i; pr_err("Couldn't find cpu id for hartid [%d]\n", hartid); - return i; + return -ENOENT; } void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out) -- 2.30.2