Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4530891imu; Tue, 8 Jan 2019 01:42:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN7R5jNYzl6pl0QgnFxPPkqJu8vCi9eFT84etCzWQMUPdm4NI8cxZP9Rhh7HfTR6a+coMwZj X-Received: by 2002:a63:111c:: with SMTP id g28mr876543pgl.85.1546940536288; Tue, 08 Jan 2019 01:42:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546940536; cv=none; d=google.com; s=arc-20160816; b=aM83+leGqKVktUeuwapyh6XQgGvj+TYL3RL1OXiOB9J8v47rEF5T+F6mDN42o3UCSP 4cbvk5Xr1p0Hqw6l3YvdM9JTus/+Bdo18hVgQovik2c+UMwXn3GBmpcZTi2rXkycmUit rgOLHz142YTrA2Xs4jX7HkRWk1j6Z2571ZlklGNMG/7kp4mM9OP30hrNlis0y0tsFVdg 7prUfHyUJj5pcoKr8wbnFE2i/cRGebZrWZB9M+P8EnIx13NkdGWkAPNnrrkfLj3vRbQN Vaa1ZJirrNwOALIMuURxfbwcZL4Wg6QVfK9dC8/XiviQSJxTqm1lvfdL9hiB0o9876pV 2UXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=6i/uWlKUBqM9+2u+MM4HIXoB6McG7saglpt4z35L7I8=; b=XyDEUmdLcP2hIxLCLhbxkfir8nua2nAWPHgeCh0fX7u+tzLba6kzXsaUcjxNT5V/up EcU438vsEx5KdbEoDN0cehjZNNRzUlpeXXB4VfeZiQyCW2l47KNZU45kwhxHnQpcMGMi cMgj77B9Y15nVt7SGQoatFpAki2p+P3qTYB4KEc0e75d4BunSw4i9K5HpDQ/vK1FUlWC UOpiZmFfvC3HMsoT9Jz4NkzocQRCqjxrRXkW1kN//ka+Dnr8kNBjy5UAC6aqHsVYwPG2 zlME8p7edw7QN2vAX1B8KFR3NcEnyyqnzpbw0pYTcKigPVy2bEZCVi6SFEti+8EH259a rx+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=ePRckkWu; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r39si17773975pld.434.2019.01.08.01.42.01; Tue, 08 Jan 2019 01:42:16 -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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=ePRckkWu; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728473AbfAHJit (ORCPT + 99 others); Tue, 8 Jan 2019 04:38:49 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:8878 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727932AbfAHJis (ORCPT ); Tue, 8 Jan 2019 04:38:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1546940327; x=1578476327; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=c3GlsSU9hpztl0F7FBnfC5nPlii3rUi/viUc2pT+k2g=; b=ePRckkWuACHDKjtLxQzXYc+3rFoluAIdBdfH4y2qkfP0FrL/V3mc4gkP u8YR0+33RPYFHgg6m/QaH+L+dZhm6eOg2vPidN2g8/2ipf03e1ijXG45Y BIBfsBV0MAvHhpJXn42nvJKHXcTVYcABp2aRCj9si/isgZDyWZtukHX2l NJ1Z6WIQTc/S4J8QOUl9u9ZCW36X3tJ1bLZSX/GXrCRsOYbzsxt8cdbAr e40gwvik5HYXN+SvjzkX8Nd+6la5gugQ9ttJgE8E0RuGHK/hdGgFYM67I BIPFrJIPRIWnomrAffNo5GbZXjW60VND92rgCZGcI6d2lyo7iqi0USz97 g==; X-IronPort-AV: E=Sophos;i="5.56,453,1539619200"; d="scan'208";a="99458407" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 08 Jan 2019 17:38:46 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 08 Jan 2019 01:18:51 -0800 Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Jan 2019 01:38:46 -0800 From: Atish Patra To: linux-riscv@lists.infradead.org Cc: Atish Patra , Alan Kao , Albert Ou , Andreas Schwab , Anup Patel , Daniel Lezcano , Dmitriy Cherkasov , Jason Cooper , linux-kernel@vger.kernel.org, Marc Zyngier , Michael Clark , Palmer Dabbelt , =?UTF-8?q?Patrick=20St=C3=A4hlin?= , Thomas Gleixner , Zong Li Subject: [PATCH v2 4/8] RISC-V: Allow hartid-to-cpuid function to fail. Date: Tue, 8 Jan 2019 01:38:34 -0800 Message-Id: <1546940318-9752-5-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546940318-9752-1-git-send-email-atish.patra@wdc.com> References: <1546940318-9752-1-git-send-email-atish.patra@wdc.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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