Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753284AbdDEFw5 (ORCPT ); Wed, 5 Apr 2017 01:52:57 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:5304 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753113AbdDEFwz (ORCPT ); Wed, 5 Apr 2017 01:52:55 -0400 Subject: Re: [PATCH] cgroup: switch to BUG_ON() To: Nicholas Mc Guire , Tejun Heo References: <1490545446-7305-1-git-send-email-der.herr@hofr.at> CC: Andrew Morton , Michal Hocko , Vlastimil Babka , Ingo Molnar , "Joonwoo Park" , From: Zefan Li Message-ID: <58E485A1.80208@huawei.com> Date: Wed, 5 Apr 2017 13:50:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1490545446-7305-1-git-send-email-der.herr@hofr.at> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.19.236] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.58E48610.004A,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 33f0633e83f7dce88d68034147a7f44e Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 983 Lines: 23 On 2017/3/27 0:24, Nicholas Mc Guire wrote: > Use BUG_ON() rather than an explicit if followed by BUG() for > improved readability and also consistency. > > Signed-off-by: Nicholas Mc Guire > --- > > Found by coccinelle: bugon.cocci > ./kernel/cgroup/cpuset.c:2125:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. > ./kernel/cgroup/cpuset.c:2127:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. > ./kernel/cgroup/cpuset.c:2143:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. > > BUG_ON() wraps the explicit if condition and is actually in use for > all conditional BUG() cases in cpuset.c except in this one function. > > Patch was compile-tested with: x86_64_defconfig (implies CONFIG_CPUSETS=y) > (checkpatch warnings for this patch seem to be false-positives - the > BUG_ON should be fine) > > Patch is against 4.11-rc3 (localversion-next is next-20170324) > Acked-by: Zefan Li