Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4320671pxf; Tue, 30 Mar 2021 05:09:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz44FQTyXXaqK0QkqaD5fro3TLmlWmmq931XGVkjUXb2u8jKWl5u90rzql1LlK14EVGz4Gt X-Received: by 2002:aa7:c3c1:: with SMTP id l1mr34008252edr.208.1617106163885; Tue, 30 Mar 2021 05:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617106163; cv=none; d=google.com; s=arc-20160816; b=cGX4uSAx8s1QezF7FjXKEVk32ug3jTAZh/VI71PAw1P7vzaxLzC5DLZ7a2DKh3TlZt vbEs3210nR7bwjiz0lMUfnRwtnakM5T24O+0r3ZFO5rUL5OY6+LAtQS0DqeJMzGTPfqa Pc5i8SP+BpNIDId4YdAVg+QWm5vTQ1BmlxtUbyfTsFqqfq2+VExkIh87dtRN+RrC5WTS 2/MBZ2IxCLsOlfLTSd/rYYUrtkncSexwzYGBQ3UiBHgMqSOWo4/n5Yv/GPgHXx6Uw94q MvjO5C/OJ9gv1oT1210zi4x/wiM2/05zrL2ick7Fm/7LZLbhhCsZ3QF5eDxUL2ZgMlSP ThkQ== 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=w2+noXRX38t0m18VozXgSQxhJUdJZBj46Y55GMT9gj4=; b=I+FkElZIURrfybmoU+owE4vre+DZRfC5fhsf/wEUDgDN7gJZ7XfmHhajPBrFNJ9zKD Wlx3rGhFuUZ3rU2eH+2q1qtkK/kmBVmcjNhwx/jpqnHfMk6ZoMnbSm4NoHfOUelhJkR/ DZiqfoksI+jKz1ejrqpawuev//Z/YgStrbCWBUhgH6d6T+Qtk2E+c12/hSaLy7KZEgFd NxTIMT0pbIQUXK/vsqMZAzH2Dzw+wxycV6uAhvvVi/4KO2zEJMYXGDOicvlvaIKXwJIU S1a1mhvlRU5bLWvQVgyIym1RsP+LVJAZBYMI6pbPqqKvri0amD9/+BJittDpqdAsngI3 I5tw== 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 c12si14597737edv.455.2021.03.30.05.09.00; Tue, 30 Mar 2021 05:09:23 -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 S229633AbhC3MHz (ORCPT + 99 others); Tue, 30 Mar 2021 08:07:55 -0400 Received: from mail-m17635.qiye.163.com ([59.111.176.35]:42970 "EHLO mail-m17635.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231992AbhC3MHn (ORCPT ); Tue, 30 Mar 2021 08:07:43 -0400 Received: from ubuntu.localdomain (unknown [36.152.145.182]) by mail-m17635.qiye.163.com (Hmail) with ESMTPA id A6ACC400123; Tue, 30 Mar 2021 20:07:41 +0800 (CST) From: zhouchuangao To: Jessica Yu , linux-kernel@vger.kernel.org Cc: zhouchuangao Subject: [PATCH] kernel/module: Use BUG_ON instead of if condition followed by BUG. Date: Tue, 30 Mar 2021 05:07:34 -0700 Message-Id: <1617106055-6295-1-git-send-email-zhouchuangao@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZSkMYSUNDTB0eSE4eVkpNSkxKS01LTUpMQkpVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hKTFVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MTY6CCo6UT8OTzczDxIVUSNL FhUaFApVSlVKTUpMSktNS01JS0pPVTMWGhIXVQETFA4YEw4aFRwaFDsNEg0UVRgUFkVZV1kSC1lB WUhNVUpOSVVKT05VSkNJWVdZCAFZQUpJSUk3Bg++ X-HM-Tid: 0a78830849a3d991kuwsa6acc400123 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It can be optimized at compile time. Signed-off-by: zhouchuangao --- kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 3047935..f46fc4f 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1014,8 +1014,8 @@ void __symbol_put(const char *symbol) }; preempt_disable(); - if (!find_symbol(&fsa)) - BUG(); + BUG_ON(!find_symbol(&fsa)); + module_put(fsa.owner); preempt_enable(); } -- 2.7.4