Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1155871pxy; Fri, 23 Apr 2021 01:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWvDIGBgNXnde88R5L4ftOY7OPn/xdNIkzZD8bc63uPkWbB8ZP0AO1ECAt2Uik5CvupuTk X-Received: by 2002:a17:906:85cb:: with SMTP id i11mr2863157ejy.311.1619165907467; Fri, 23 Apr 2021 01:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619165907; cv=none; d=google.com; s=arc-20160816; b=E8UJtLU2v1tYlDnU7vPhwVujRHQl9AASsN1GIHzW3LmnU72VonVw/vMvxVEOCd7MVK 8LONRpkwsSq8AFQRcmp+wxSFJvEJZEUlK0zt4A9vMXMgQ4M5fvzjtIAN1zNg6qzQ6R0C bLlq23qnpzHdkTqExCpb+pVYnQArRk3m7VUtWOMKJgL1AGDVuC3XfjCbrrLk7tsH5Vyr +/1ABtWsJIUrltqOjJYXVBIkS9i6M0xawX4Ob0aW+btt44FAV+twlfqdSIvBWm/rlR7d Kd2lCe3CUA0kFwTffs8R7b/jXZdFU/w9wnJAQL31EuX0Z0RS2XVh3DEst1nKrDxwGo+3 Rp+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=pvEMyIoKZQ+OpHJuaoUeVEkT5JSS8Qp2ETmQ//grJBM=; b=a/EUd3xIbzFMG24JedHGz3C4x6NhZcNXKeV1ZQ+LEqcpZKVPHbKmD5anrmeAhfl82b Oe0kSXCSIH+i9oEhcgTCD0HE0g+5WDDL137ODxeB9hzloeh/Zjl3s+oo7/Gow0sFhSod AWNRgGYVXVAbAPeZQeDvIqKRWRMGu4c3KY36WnmA9qrNW4oIGBYDBPMIO7JqzGA9nCHd 7eWwZVeuKpPLAwUqc2e3CEpUbGFXEsz5AQmXHdv8/K43a0h9ehJt3IuFbZaIK0XvwxLh 6mguLV6gKJu0JyUVUxU4bjg0uBacos2YLGKyF7MWaELeVgzRcMeXyJ/D21tq24ZhYz4u hwJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o7si4475939ejj.449.2021.04.23.01.18.03; Fri, 23 Apr 2021 01:18:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241447AbhDWIPc (ORCPT + 99 others); Fri, 23 Apr 2021 04:15:32 -0400 Received: from mail-m118208.qiye.163.com ([115.236.118.208]:27228 "EHLO mail-m118208.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241376AbhDWIPb (ORCPT ); Fri, 23 Apr 2021 04:15:31 -0400 Received: from ubuntu.localdomain (unknown [36.152.145.182]) by mail-m118208.qiye.163.com (Hmail) with ESMTPA id 0785DE0104; Fri, 23 Apr 2021 16:14:53 +0800 (CST) From: zhouchuangao To: Wei Xu , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: zhouchuangao Subject: [PATCH] arm/mach-hisi: Use BUG_ON instead of if condition followed by BUG Date: Fri, 23 Apr 2021 01:14:45 -0700 Message-Id: <1619165686-69955-1-git-send-email-zhouchuangao@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZQxoeGVYYHUpKSklOShgeGENVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWUFZT0tIVUpKS0 hKTFVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OAg6Egw6Fz8XMA0eDRAhHxNM HjEKCzVVSlVKTUpCSk1OTUJITUtCVTMWGhIXVQETFA4YEw4aFRwaFDsNEg0UVRgUFkVZV1kSC1lB WUhNVUpOSVVKT05VSkNJWVdZCAFZQUlIQ0I3Bg++ X-HM-Tid: 0a78fdcbc4ec2c17kusn0785de0104 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org BUG_ON uses unlikely in if(). Through disassembly, we can see that brk #0x800 is compiled to the end of the function. As you can see below: ...... ffffff8008660bec: d65f03c0 ret ffffff8008660bf0: d4210000 brk #0x800 Usually, the condition in if () is not satisfied. For the multi-stage pipeline, we do not need to perform fetch decode and excute operation on brk instruction. In my opinion, this can improve the efficiency of the multi-stage pipeline. Signed-off-by: zhouchuangao --- arch/arm/mach-hisi/hotplug.c | 3 +-- arch/arm/mach-hisi/platmcpm.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c index c517941..b9ced60 100644 --- a/arch/arm/mach-hisi/hotplug.c +++ b/arch/arm/mach-hisi/hotplug.c @@ -193,8 +193,7 @@ void hix5hd2_set_cpu(int cpu, bool enable) u32 val = 0; if (!ctrl_base) - if (!hix5hd2_hotplug_init()) - BUG(); + BUG_ON(!hix5hd2_hotplug_init()); if (enable) { /* power on cpu1 */ diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c index 96a4840..6c90039 100644 --- a/arch/arm/mach-hisi/platmcpm.c +++ b/arch/arm/mach-hisi/platmcpm.c @@ -82,8 +82,8 @@ static void hip04_set_snoop_filter(unsigned int cluster, unsigned int on) { unsigned long data; - if (!fabric) - BUG(); + BUG_ON(!fabric); + data = readl_relaxed(fabric + FAB_SF_MODE); if (on) data |= 1 << cluster; -- 2.7.4