Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp1816243imc; Fri, 22 Feb 2019 11:44:15 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ09K4YZOafpHpNdD1LLTO6f77c7Y0hLaliJE65Vdi9F2cPhg4GQX/ufzD/1vgDXxZExmLe X-Received: by 2002:a62:35c7:: with SMTP id c190mr6024511pfa.76.1550864655829; Fri, 22 Feb 2019 11:44:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550864655; cv=none; d=google.com; s=arc-20160816; b=MasMVu2Wq/he5DNAo8a87YqW8R0MAYsfahcFJ1W0n8PZgFxe3AyCsil8V9QCHMEBKo HFSw7KuxolC5ZiIPXCCVWsZ0IvpVL3ZE7xkTcD97mWtFISZLyZWkrD8Bj7uUL+R8wW1G /Bdrkl/Kx3tSQnyTxyp1yrD5Gx4Izp5xrybRG6E4q/XOv5FE1otay/BXvyWuK2o/ZzRx I3syeU2fFHo5X2CwBwbhssWDra9oLqLuBG3RaABww9ZsZDjeisOral3QldMmw/4XPc6B A0mwGHNejco0JbaXoe1vkDd0qTGJMTk9NtRlj9uVqbPtFDXjs5HtudC/O89ouIPd7L6D ih6g== 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=LT+TQXEyzAhDa4veJzKF4qvBq8lB/5e4edmvwYCSE3g=; b=mVYuds3HAk2BRnbNpH4Osr2Neqfnn6mV2yrfliGdT3effY4EzbM+92RmlnWAevPiIC gH6yjaLPu7S23Igdu+7mpy62FXK9HXU0kfSNWZ3jOHlseTyx6u7KTWK3dYTnAuDvQYz1 Jj3v4h3ivU/buIfbRGs3M/h4dhy/CIgc6ExjWscQxwW527c5IonlLm3XsOlK0PVrSYjl PCddIphyudJ6e3G5F2wDmNgKQaPPDwdCZhWypCFMJso8q0IdGiqBK+uyVm9R6Oz8/YAt uGER3N2x7A/1iE7xfK+QgIfwuXta2s1qK+5ivvRwbgZZdW7EVl9FH95XNBBx0Am3FwRK AK5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=qlC3DT+L; 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 w18si1215067pgf.439.2019.02.22.11.44.01; Fri, 22 Feb 2019 11:44:15 -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=qlC3DT+L; 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 S1727036AbfBVTmC (ORCPT + 99 others); Fri, 22 Feb 2019 14:42:02 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:9380 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbfBVTlp (ORCPT ); Fri, 22 Feb 2019 14:41:45 -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=1550864505; x=1582400505; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=BXPJoBB0Kgm4J4WvDGeNZxKZbFFkYo9XWYKOd8CvDv0=; b=qlC3DT+LrLa1cBcgwtWMmF3fX5AYfwYrJClz7lbN/S0wQb+/GqARS2EL BKkBMrHNAHLueK/ivY/8LA288EWvYnmPWSMwTMY/TNUNuCZDI/rNGtRv1 2bM2R/Boq70V92LFlpKJNQ4oPjUavvKwSf7EcEU2PiWDUA3syPHRiUrol ZeAq1u355nidTr+c4UtIaLj6BZY1Dy3XzExep1Q9hIXCO8MMLBEmKZ3Jh SqZvvJppHbY96Aa+Z6/PcHTaR40xrsm76AGyBPhnUznCh8QoU6+6S4Mab chQXh7Tlfk05wGPhgKcjqYvLgWv9Kl0g8jRTOEghKkXx71A6U620WIu2J g==; X-IronPort-AV: E=Sophos;i="5.58,400,1544457600"; d="scan'208";a="103727137" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 23 Feb 2019 03:41:45 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 22 Feb 2019 11:22:04 -0800 Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip01.wdc.com with ESMTP; 22 Feb 2019 11:41:45 -0800 From: Atish Patra To: linux-riscv@lists.infradead.org Cc: Atish Patra , Alan Kao , Albert Ou , Andreas Schwab , Anup Patel , Dmitriy Cherkasov , Johan Hovold , linux-kernel@vger.kernel.org, Palmer Dabbelt , Paul Walmsley , Thomas Gleixner Subject: [v6 PATCH 4/6] RISC-V: Allow hartid-to-cpuid function to fail. Date: Fri, 22 Feb 2019 11:41:38 -0800 Message-Id: <1550864500-13652-5-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550864500-13652-1-git-send-email-atish.patra@wdc.com> References: <1550864500-13652-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 Reviewed-by: Anup Patel Reviewed-by: Christoph Hellwig --- 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 b69883c6..ca99f0fb 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -60,7 +60,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