Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1104882imj; Thu, 7 Feb 2019 17:52:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IZJ4L3yLT88unmjPXOwbDeKEQBQTo10K0MC/+hoij+URKTVg3Awf9Z6J5Y8Z2dDclKE4Oeg X-Received: by 2002:a17:902:14e:: with SMTP id 72mr20023383plb.287.1549590729686; Thu, 07 Feb 2019 17:52:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549590729; cv=none; d=google.com; s=arc-20160816; b=MzVkOz5ElYSzsXpOYe2kQFQPuw5QvSp6jEU0l8J7SKHEl3Oul2BwiRNwTHZtRmwZJD 8IVcskZVEe0RM7sRCAeyBOKHFG1pK9IaLHn5A939+9qGAFE+yvxDZ89czvmJ7q2KUNA9 Tdb6gS7QFfv3kRcSJagdwoBw9LXfcd5NNRBVjp0GMcEdh035b1ZBFK3Z8SaLgD7fyj9c sjJEsD3yA5tcZwmjRQVQixd9Ba+SosnFaEDoZAAcdXT+o12dFofNVWukCJUGz+NZc82S mrFODEkd88EZ8n/j/1/1d7TMQ4XSCmLNfY/l1qZGE5M/w61Kg276PVwdAbtIG1/h+QCj +xfQ== 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=Dc0p8NaAXe1oZr86nsLTm44fiOaXC43NPC4+sFjYTNY=; b=n6vRyuv43U9TQHuhhIHKyiBh2sqDdvBWxDYBifZdpu7QjGAEn5aUskc3ok372JULL9 jh+aHyDybXn7PpSU3b9YZgKKXwOw/RVPmEdLGVp25s19RhIPeZLIXo/TiOgpc/+bYkhC W2vFiXZ01kZgaDra6jF74Yr24sn+U6RFxmTFNLbBV6TpbKEM7qgJOLQRmai3z8MKkk2c zjDvDeoVp914o7v8b4bu99oxwZD2sRCOJ2wo97XDgYYCuPXpMm9a+mxROV2ENpPpDqkB SI34hVEQdCpX6NhJi351qcXkIsl0A4c40xILyYuYgErlFGerE39sYH0eJgGZ89benyF5 rkrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=bBRisIwb; 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 f34si734070ple.280.2019.02.07.17.51.54; Thu, 07 Feb 2019 17:52:09 -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=bBRisIwb; 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 S1727236AbfBHBvj (ORCPT + 99 others); Thu, 7 Feb 2019 20:51:39 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:13327 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727215AbfBHBvh (ORCPT ); Thu, 7 Feb 2019 20:51:37 -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=1549590698; x=1581126698; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ViV6PhKpKnhRP9ucbxYfmK43deu7UXliWl3/nyU8MVA=; b=bBRisIwbvOX2btbEgLoDANloPT80LDxWwbARPCd1Ar5zVS4W9uXaTi5X XFEBezW0q8NhSIy7NvWHErA/f4p/PKGUgI0ko5qFwiCyY6imuD3Gn6CHB bGI2T7+Aumq1DcvPt0dUW7r3a2aFmPg1VZvc5JuEz4kveGf6B2nyIJhoI WLgs4MKSVgf6o7mjuxohdw3vmCoO+IP/tH/iTb6HXzr4gsspMnrFV5DS5 bnjvKRvvL2L8TfwngHhfBYvDgk8RAUjroTxlfEdyyC5mgChFzw0cZjFNd N0zEFENnLZ6gNiUCxx6KULWgTTtpAImedbJcQJlmFSco5wa/IXrY4UH8o g==; X-IronPort-AV: E=Sophos;i="5.58,346,1544457600"; d="scan'208";a="100752802" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Feb 2019 09:51:36 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 07 Feb 2019 17:32:19 -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; 07 Feb 2019 17:51:36 -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 , Palmer Dabbelt , =?UTF-8?q?Patrick=20St=C3=A4hlin?= , Paul Walmsley , Thomas Gleixner , Zong Li , Damien Le Moal Subject: [v3 PATCH 4/8] RISC-V: Allow hartid-to-cpuid function to fail. Date: Thu, 7 Feb 2019 17:51:17 -0800 Message-Id: <1549590681-24125-5-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549590681-24125-1-git-send-email-atish.patra@wdc.com> References: <1549590681-24125-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