From nobody Sat May 10 03:04:41 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail(p=none dis=none) header.from=linux.alibaba.com ARC-Seal: i=1; a=rsa-sha256; t=1607745050; cv=none; d=zohomail.com; s=zohoarc; b=KqeShNfioG6uf6XqLT+hx+Y7618ZVsLJhOyQWDS1p4zl//uZuW0+vWdZS58NMWd6Aqp+ZLUUBbP7EtLiF+H2ecJPbBBNzFBpnlSq+iPOl2+9AZheo985Nz8qHqJS20MQk6jfvKzqtfkFksvC8NDZvw5CjVKiAnf321IqLSmLCYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607745050; h=Cc:Date:From:List-Id:Message-ID:Subject:To; bh=uu5IJXWIL7K8IdXvAYgbJ+warz5E0w8V5llEI05+2kk=; b=emxrjiANtxahkloREd61Mty0HB7gq5N5cjUNSlKd21hHj+oRIXfpvdtYP+50hhjUwfJkyB9hysvLEROOKW3TCjyrpYwEe+fgEt+460Yeg9gadtXQl8XYoOT7Nq40EySlvitwvMF2eEM7t0acNN+435b26Qby4iSmUbImKojoujM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1607745050495565.4459602974229; Fri, 11 Dec 2020 19:50:50 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438013AbgLLD1a (ORCPT ); Fri, 11 Dec 2020 22:27:30 -0500 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:58081 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438000AbgLLD1M (ORCPT ); Fri, 11 Dec 2020 22:27:12 -0500 Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UIIAwQ4_1607743587) by smtp.aliyun-inc.com(127.0.0.1); Sat, 12 Dec 2020 11:26:28 +0800 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0UIIAwQ4_1607743587; From: Alex Shi Cc: Minchan Kim , Nitin Gupta , Sergey Senozhatsky , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/zsmalloc: replace if (cond) BUG() with BUG_ON() Date: Sat, 12 Dec 2020 11:26:25 +0800 Message-Id: <1607743586-80303-1-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" coccinelle reports some warning: WARNING: Use BUG_ON instead of if condition followed by BUG. It could be fixed by BUG_ON(). Reported-by: abaci@linux.alibaba.com Signed-off-by: Alex Shi Cc: Minchan Kim Cc: Nitin Gupta Cc: Sergey Senozhatsky Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/zsmalloc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 7289f502ffac..1ea0605dbe94 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1988,8 +1988,7 @@ static int zs_page_migrate(struct address_space *mapp= ing, struct page *newpage, head =3D obj_to_head(page, addr); if (head & OBJ_ALLOCATED_TAG) { handle =3D head & ~OBJ_ALLOCATED_TAG; - if (!testpin_tag(handle)) - BUG(); + BUG_ON(!testpin_tag(handle)); =20 old_obj =3D handle_to_obj(handle); obj_to_location(old_obj, &dummy, &obj_idx); @@ -2036,8 +2035,8 @@ static int zs_page_migrate(struct address_space *mapp= ing, struct page *newpage, head =3D obj_to_head(page, addr); if (head & OBJ_ALLOCATED_TAG) { handle =3D head & ~OBJ_ALLOCATED_TAG; - if (!testpin_tag(handle)) - BUG(); + BUG_ON(!testpin_tag(handle)); + unpin_tag(handle); } } --=20 2.29.GIT