From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09773CE7A95 for ; Mon, 25 Sep 2023 10:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230114AbjIYKIA (ORCPT ); Mon, 25 Sep 2023 06:08:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbjIYKHz (ORCPT ); Mon, 25 Sep 2023 06:07:55 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86931FC; Mon, 25 Sep 2023 03:07:48 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RvJSD1NTPz6K7TJ; Mon, 25 Sep 2023 18:06:36 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 25 Sep 2023 11:07:45 +0100 Date: Mon, 25 Sep 2023 11:07:45 +0100 From: Jonathan Cameron To: Jeongtae Park CC: Dan Williams , Alison Schofield , Vishal Verma , "Ben Widawsky" , Dave Jiang , Davidlohr Bueso , Fan Ni , , , Greg Kroah-Hartman , Kyungsan Kim , "Wonjae Lee" , Hojin Nam , Junhyeok Im , Jehoon Park , "Jeongtae Park" Subject: Re: [PATCH v2 2/7] cxl/region: Fix a checkpatch warning Message-ID: <20230925110745.00001127@Huawei.com> In-Reply-To: <20230922113520.3298976-1-jtp.park@samsung.com> References: <20230922113520.3298976-1-jtp.park@samsung.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml500003.china.huawei.com (7.191.162.67) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Sep 2023 20:35:20 +0900 Jeongtae Park wrote: > WARNING: else is not generally useful after a break or return > > Signed-off-by: Jeongtae Park > Reviewed-by: Dave Jiang This one is a little ugly. I'd prefer to see the error condition remain out of line (vs the warning one) if (!IS_ENABLED(CONFIG_CXL_REGION_INVALIDATION_TEST)) { dev_err(&cxlr->dev, "Failed ..."); return -ENOXIO } dev_warn_once(... return 0; Or keep the else. Not that important though as code is small enough that less than ideal in / out of line doesn't matter that much to readability. Jonathan > --- > drivers/cxl/core/region.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > index e115ba382e04..1fc9d01c1ac0 100644 > --- a/drivers/cxl/core/region.c > +++ b/drivers/cxl/core/region.c > @@ -133,11 +133,10 @@ static int cxl_region_invalidate_memregion(struct cxl_region *cxlr) > &cxlr->dev, > "Bypassing cpu_cache_invalidate_memregion() for testing!\n"); > return 0; > - } else { > - dev_err(&cxlr->dev, > - "Failed to synchronize CPU cache state\n"); > - return -ENXIO; > } > + > + dev_err(&cxlr->dev, "Failed to synchronize CPU cache state\n"); > + return -ENXIO; > } > > cpu_cache_invalidate_memregion(IORES_DESC_CXL);