Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3066933pxj; Mon, 17 May 2021 16:56:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3lfdByvg86s/zj5Ud+uHNsuoo7Ci74GRUN4i02wNi5ckIpqcbdjXTk+9o5lcJFSqfvDLc X-Received: by 2002:aa7:c718:: with SMTP id i24mr3167780edq.43.1621295781405; Mon, 17 May 2021 16:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621295781; cv=none; d=google.com; s=arc-20160816; b=zrIgHbyuO0Pq/Njn8nu5U1V2pauPDwiHswHE0T+iPte6Kd9lkNmhyzRMXMKOZn8PKU vevjNFmRt9/KpeaiHJWvRDZ5ncf7lgCyk/7D+kZTQvc1VZIuUZD5WlFvw6B6Wkk/uPuz W42CPyAwmjryqVYVnmIIE7hUSwWCCgjKe/b/KK7W6eTue+L/6/VF9RJcWmJbBAF0AaTB AL+hCsoq5GWlMIm3vLILK0uDkLJ5hG1X6C/jnrSA+ASIb5t0762YH0BzJW6lcFEO6JnI vR27dodDTYK/7zft+lpNgZx2BOY8P9vcF6N1scMU4Cto2AUd7kNfL5YwmChA8d/rydxN UjaA== 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=g7YEmervvn+u6cOcSC88uRizLzwZnkg2sd5alI0V2DygehJW9M4YMaZSmUgFb2KZhe fyQJYFVCEpk3FP+5HnU6On1m0NqCw6Hkya6tASSMZyfNN6VFdLdpZ9FOmnobuVS4nfHS m8++/p/TiKXVhvNrxbO6NEuMFwmOLmi3Fq34ftCWWP736kBWtMrezj9YkjdAlFyiuxuD 7gUUjHPqrZEn0zg216oIt/tCG33H7Kwjj8FmXUmqLikZ54zB/p+cjXh0vcVrzuJ8oPI5 ujSl0JD14mbtDXIB4PBStPz2//6cXceOo47kZ6LDGIJeGggo9fL3piOAES19Ph/YOepC +Dfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HyHDcvvn; 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 v11si15812905eja.569.2021.05.17.16.55.57; Mon, 17 May 2021 16:56:21 -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=HyHDcvvn; 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 S239673AbhEQOYl (ORCPT + 99 others); Mon, 17 May 2021 10:24:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:37626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238639AbhEQOVQ (ORCPT ); Mon, 17 May 2021 10:21:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3D773610A1; Mon, 17 May 2021 14:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260699; bh=yb2t9n9d73ncxUe8UzTCxpoOQfoZZe3tejDhEVDgH2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HyHDcvvnBt/nnDyRyr18UgFWfx+dunk0/oj9FbTRIlYDctnSe2c7DP1mrrLrxM9LM aLneOp2TA9mCNdHcOasEqSrjepr8U+s4ZNC0BQHK85O12zHdWQ7/ErIaxt/11wYrpr 08Sh4RkIgGjyFg7OSZxsB8qbXIGP0RB/+iSCZzZ4= 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.12 200/363] RISC-V: Fix error code returned by riscv_hartid_to_cpuid() Date: Mon, 17 May 2021 16:01:06 +0200 Message-Id: <20210517140309.349070040@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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