Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3712508imj; Tue, 12 Feb 2019 03:27:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IbmbL58V9lNxDR/stEm2gutjU/zeR2zE0DN30pt4wNs1AiTUqFalw8w2IetrytrbBHUxK4Z X-Received: by 2002:a17:902:e287:: with SMTP id cf7mr3608791plb.51.1549970849791; Tue, 12 Feb 2019 03:27:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549970849; cv=none; d=google.com; s=arc-20160816; b=0A2THhGfnnzfP7sysYr6G4dA62Jx/g6oNICS6e950MG/X+PAFGRaAiHc8vDkNFBGJc Lsn2J8sSpgG4d/t2D5FfwjB3O5Uf8rkWREPvu1+4Q0i9USc8gyHKUY0XmBoMw/+tBI5j j5J5PfgDaB2hXWweg44JYQqiht14SaCQR5JzeVR11MD+7nU4Gja7LhRoq+AoxKvTLXy3 4bVWnEWUDnYu9x0FFgNO+X6xziyNplILF1b6JjaQ8oYuwM5Xy1YdzuaegRIGpfgfhHAC 6ynNrFv/du2J4vkLxVU9uWun5MU/U/gQjDQZwEOtTYilrby70/I7yS54yNP7QLMVJ4ws bJYw== 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=Rj/nZoKV1SDgz9v69ujD2YtFhFXBKm7ISobBCbxejva8tadvKDU8xmx58hwUk6oCUf bYS/NRhyl4+pzJMQ1L0vT7fuXKoHcMNG4oOAyUlLwtJ12IteNhwShvszyIiHj0JNWEyC L4wLxeGZd9SZH7jjJObxD00Fcm1DH0XadwPXy0q1a9kNA8qm2RfBaTb6Jp3R4J/uiGll MTTNGIQQKVFc0c2zv3mu1krkmiJnr89MfDTpSMYuPKE+3q3wacRDKPwZuNrcWYc+cdkm Ctj9Ez1qc3OdfCpHAidEVV/3uACLjPFoRE3g5fZjHpyQ1u9tjCVn6YUTqsOQeU8sD1FL rMhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=fQ+yGJcV; 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 y3si11616229pgp.48.2019.02.12.03.27.13; Tue, 12 Feb 2019 03:27:29 -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=fQ+yGJcV; 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 S1729333AbfBLLKf (ORCPT + 99 others); Tue, 12 Feb 2019 06:10:35 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:42874 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729250AbfBLLKd (ORCPT ); Tue, 12 Feb 2019 06:10:33 -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=1549969889; x=1581505889; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=BXPJoBB0Kgm4J4WvDGeNZxKZbFFkYo9XWYKOd8CvDv0=; b=fQ+yGJcVu0acRfVujvJ+qeJkaUSQ1Dm1hTxvbDO5Z+7aoyLMZ5XwfKvK 7DYyiJIX3bvT/I3iqimFpz6suontY1Xca2pRAraCIrG4Bxb7mgfMp4XBS +9sbullD18We2n/pOOG1PB2V6XtbWVUf/vj9KgyPnKgAqi4WwVEf0ZDS6 Mk65vUM1Cfs4VwEWRyFS8MiHheRHp/9pxldnISnEr3T9nuopvUqeVjCVx 4H6fDaG6xPxmKVGm6o+iSIXQjTimhzG2mDElqgtkjNm0eSAcSllK0eyA7 TEFlQyRhV2ajUhN67dX+d3rJIj+GEvoUXDP85ago/mWl62qFJwdmVN1iI g==; X-IronPort-AV: E=Sophos;i="5.58,361,1544457600"; d="scan'208";a="199201831" 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; 12 Feb 2019 19:11:11 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 12 Feb 2019 02:50:57 -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; 12 Feb 2019 03:10:22 -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 , Johan Hovold , linux-kernel@vger.kernel.org, Marc Zyngier , Palmer Dabbelt , Paul Walmsley , Rob Herring , Thomas Gleixner Subject: [v4 PATCH 4/8] RISC-V: Allow hartid-to-cpuid function to fail. Date: Tue, 12 Feb 2019 03:10:08 -0800 Message-Id: <1549969812-22502-5-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549969812-22502-1-git-send-email-atish.patra@wdc.com> References: <1549969812-22502-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