Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4639460imu; Tue, 8 Jan 2019 03:50:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN5BiYWBEOmxZC9WRQULeP4Ig2a3v5eU9UHd31hYNob3dGH1RFaZh/qi1K3nNIV+bJcIEE0A X-Received: by 2002:a17:902:8687:: with SMTP id g7mr1470760plo.96.1546948240612; Tue, 08 Jan 2019 03:50:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546948240; cv=none; d=google.com; s=arc-20160816; b=SIzPLR1tehueZOIUXslBpv3p0JCgYjC3QoI6d87XJRRgv0KZpSQtsMoeyjhkY62XNO tGEyVCS5ZYKvRj9imysBHENy7YyyXbTxbHle9LdoI5D0DCoNkvnHq18OJhsCvfifr0SO e+N6f+1NQvwd/2m4r/GtJJQEhw/aAHKYjLsqbas1+BuBLoLQFKduaUuj47p8UEG5vjHW HqE586rtqNRZ2lreKuA8IT2syG4eaHF2SKvFy/sV+kIKvCtDbKpcGB8MW9S8j2kcvWWC brd2YaZSLYtiIgZ4pDS/etaS+DCvFinjeSK//95yYLyuktZHdtUn0MUCebJU7sjHGUgb 04Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6+V0n8Xtcjz4tHs8ZXrRMUNU6iatKnY0VEqk+wmS3fU=; b=sRq4ymIBcCwCXz2iB36kXUyHEt4LRmcdfIeg5xEH/tIhHMlz75hk+BPuvwkc6rQgrQ K6Merd8Di8TSzNOV4yvUYsZrwj+Iong74wenNRAgf/Ra/L7PZPUGtAoD2+E66AZdpWIK wR8iH/p9zvnx0hnlEYgMlAAPFA2QIECv3y4GoVBYnsTsLVHlBzyNd8Yle8jT7CdR8M4h THVSatWEtki+DbZ8B/x+ygfIaE6fJoF+EsOQwWbV2J9XhKb3ChbuJIeh3ALECjeCuIwM o0ChU5S8gHmkbmZRtGMSOeSNMHS2XnJggqika439eC5bP1NYAQxDQfubJufVxe5yf8Dv Ieww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=RJVNzMAI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x32si307435pld.316.2019.01.08.03.50.25; Tue, 08 Jan 2019 03:50:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=RJVNzMAI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728738AbfAHLtO (ORCPT + 99 others); Tue, 8 Jan 2019 06:49:14 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38487 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727236AbfAHLtO (ORCPT ); Tue, 8 Jan 2019 06:49:14 -0500 Received: by mail-wm1-f67.google.com with SMTP id m22so4086384wml.3 for ; Tue, 08 Jan 2019 03:49:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6+V0n8Xtcjz4tHs8ZXrRMUNU6iatKnY0VEqk+wmS3fU=; b=RJVNzMAIesjPC3AE2E+TOmmX5R6vuJzXu/efycylgwXhE1CxBo434WiRvT0LIlPnqH Xbs7Rz8UXSpXOq4XvCfjiajPfiN0SpQDl9EuxEW++yFRJ08jY79tWwbNpMH+RyDp9nsW l1Zk3ZRzGq2KusdLTTZpDyOuFnw32FfI3ut5Fy/PGBeqyHAtH706e+dS9kvvBRp5+Hex mgXXSpXi6nUEfY5HRxgqTsZfXzX7S13J3jG7VQqV8Twpsxsdb/5i9of1VVAu+gYA7iSC 71Y6m0RinP6SMCR19Ywy2bMXErQukqsPEvmYvaeRu2iZ6unrQHF18h62pBdqFTwRr3yo rvmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6+V0n8Xtcjz4tHs8ZXrRMUNU6iatKnY0VEqk+wmS3fU=; b=Oz/ycpEsR8n9WhzAVcYmx+k+5OpYtd4uyY0SevQ10kRire3Qj3HnuGmTZCPHXW77dW QorUZG7jX8f51alCS7WNAz9aUqurLDuPAsnqV6w/f5JKf8sySbKDrlIpn1g66m5dxAKO hdhkmhm8+U9LRMETH8G2dOdjLlHBV1LNqyDS4E8uFqdJ/NOvZ6av1Hnzhu0Dkkmzf8T5 vGZI8a/LSReugtrAyii8YRM7SkPpTJhj58g+2AFrEToQOStQZsLgD9E9tLjo1j1TYrI1 +aSpcYXZqoPlQ+xwsAjRemN+/l2fchkG8PlTdIcK+T02EQ4CpTGUc5G/qOIEEnjqmUqN vcmw== X-Gm-Message-State: AJcUukeFr/yDUIt48nuv4OMk/vq9LCgy5j5vtsbAty2waXdBrZ8nGqUp px/NmyVpyotdV3crUEMZ/jAbBGQ8+ES+DA7U9kat2Q== X-Received: by 2002:a1c:f509:: with SMTP id t9mr1641639wmh.76.1546948151708; Tue, 08 Jan 2019 03:49:11 -0800 (PST) MIME-Version: 1.0 References: <1546940318-9752-1-git-send-email-atish.patra@wdc.com> <1546940318-9752-5-git-send-email-atish.patra@wdc.com> In-Reply-To: <1546940318-9752-5-git-send-email-atish.patra@wdc.com> From: Anup Patel Date: Tue, 8 Jan 2019 17:19:00 +0530 Message-ID: Subject: Re: [PATCH v2 4/8] RISC-V: Allow hartid-to-cpuid function to fail. To: Atish Patra Cc: linux-riscv@lists.infradead.org, Alan Kao , Albert Ou , Andreas Schwab , Daniel Lezcano , Dmitriy Cherkasov , Jason Cooper , "linux-kernel@vger.kernel.org List" , Marc Zyngier , Michael Clark , Palmer Dabbelt , =?UTF-8?Q?Patrick_St=C3=A4hlin?= , Thomas Gleixner , Zong Li Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 8, 2019 at 3:08 PM Atish Patra wrote: > > It is perfectly okay to call riscv_hartid_to_cpuid for a > hartid that is not mapped with an CPU id. It can happen > if the calling functions retrieves the hartid from DT. > However, that hartid was never brought online by the firmware > or kernel for any reasons. > > No need to BUG() in the above case. A negative error return > is sufficient and the calling function should check for the > return value always. > > Signed-off-by: Atish Patra > --- > arch/riscv/kernel/smp.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c > index e407bd4f..ce9a2e73 100644 > --- a/arch/riscv/kernel/smp.c > +++ b/arch/riscv/kernel/smp.c > @@ -58,7 +58,6 @@ int riscv_hartid_to_cpuid(int hartid) > return i; > > pr_err("Couldn't find cpu id for hartid [%d]\n", hartid); > - BUG(); > return i; > } > > -- > 2.7.4 > Looks good to me. Reviewed-by: Anup Patel Regards, Anup