Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1870361pxu; Sun, 13 Dec 2020 06:07:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwthMAabJlMow4sLe4bsDZQCS44gnyQMd9op8c/sztsDMMF8gOgS+LMV2RCR72yHk2yZSeb X-Received: by 2002:a17:906:354a:: with SMTP id s10mr19101477eja.335.1607868463102; Sun, 13 Dec 2020 06:07:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607868463; cv=none; d=google.com; s=arc-20160816; b=nOkOlOJeyqkpqg2kUm5GP3KWoTPzY/rOdq7C1l+R601BRbs1g2h00FBAdxBdOaongP UDtErd7F9w5NsMCLK9rkDDJW6UzaPP1vpia81BfmL5i3FMwln37fuGayeYlGkcgN12hy JqvXAPxP/1fUnBRUYmgliFpLyjjulpe09t5EX5fc1k19j51wwYKRbVdht+o0N0CG+eRY LVDNTVTrMwqFE8ohJAWer8h5tAYXvfvKS7mFDfY6ZVGh2fN8YlLB47KGlqqkFko4/r4+ LkESx0NlEDJ4LigZlJQc3yvlBM4ZAV3vNG8uKAg7dbbp0VAPCpoXbk0L2pZj0GlmtcbC TiEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:message-id:date:subject:cc:from; bh=uu5IJXWIL7K8IdXvAYgbJ+warz5E0w8V5llEI05+2kk=; b=ErOZwwW8574aD26MBAKfx0IdyL3inBSRawLCPyPEakxKOYqTsEnSi6RojhvFc6Ep6w HDuaMAstRcIV49vg5xdQlEz5haMlxvt+e1wt7e9X+Eqdd1uwFZqprJ/TOmdY0LPgmRKf DzXlsOvPFsR48M+TgDiX5DhLElE3b7H/e2nubacWOi85BTEn7qIxB93UthF5NHyuCD/R YF1eAFZMlUoMUwqxmGumksAIjKD3tqRT5StuT3jjKVXq++HZYBPDPSsXBQdDV6PQzLzG n3wz1sctKHntHAetTfNsAqojrAA1WKCD/dCn0SPgGOOmJt/jfH2IJFpn6Jv7PPIfkNry 2VHA== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si9531386edc.387.2020.12.13.06.07.20; Sun, 13 Dec 2020 06:07:43 -0800 (PST) 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438009AbgLLD1a (ORCPT + 99 others); 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 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; 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 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 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 *mapping, struct page *newpage, head = obj_to_head(page, addr); if (head & OBJ_ALLOCATED_TAG) { handle = head & ~OBJ_ALLOCATED_TAG; - if (!testpin_tag(handle)) - BUG(); + BUG_ON(!testpin_tag(handle)); old_obj = handle_to_obj(handle); obj_to_location(old_obj, &dummy, &obj_idx); @@ -2036,8 +2035,8 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage, head = obj_to_head(page, addr); if (head & OBJ_ALLOCATED_TAG) { handle = head & ~OBJ_ALLOCATED_TAG; - if (!testpin_tag(handle)) - BUG(); + BUG_ON(!testpin_tag(handle)); + unpin_tag(handle); } } -- 2.29.GIT