Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1397384rdg; Fri, 13 Oct 2023 23:58:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFd67+IyLtOYEVjt0kzMhQ0YlbkdUmaBU48AJYXdYEBvlNXtnxWx6tyOHp2Uv6BCJk2dATy X-Received: by 2002:a92:da86:0:b0:357:6dd8:2c83 with SMTP id u6-20020a92da86000000b003576dd82c83mr2222960iln.29.1697266723731; Fri, 13 Oct 2023 23:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697266723; cv=none; d=google.com; s=arc-20160816; b=z0wKAROpdULtv2vnxBB6fiCd3RZ9uMJc+NYif5PpvuHDmMT4+zU33hqhsByhowhoP9 /4C4Lqx8q9542UkX+nlD4iNg+mAVfFdcx0bImYYHCdpfduhzNmUXf6adeDRzNeXKf22h S8Z/wjY8+BjbT9yvrAMjSDjXw0CLr+g6CEqADgwEEmZCFtslcf18AtyimH9+auSZpS7M G4Djfcv57MDY2oFNcImv5Afooj1IagCdMru3ErGf/fcVYqDj+ePxBYJiLoEb0wza5aAa 6Uzy8lFH8jv0pxaMGmH3gMttFpPJQ/8WVkEO5jqwN1bXGd/6raLAKvi7/Ynoa8QN88Yt dKKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=sN/M4L6Q9tZIGosWFp/kcGmAa2Y/6EWiUPwyWfd8rKE=; fh=Y/3Wn+KbkQjqqsA1ioRHkhpt8ligmWBl+5hpCgKo+LA=; b=Dh2OkXqeWqu8egU+RaW9ph6VDdP7eLu8djLV53HRVxLaSqtEFj/WIANVegBfgSXV+i vkQlYBCjWVLm2lzRHUM+VPIV4qaaa3jl9hPTrur9S+VgQaYK1X9WoVDTl1r7ZXETyTGj 0+/plRHmSsuKUOlUGbtNlhWJK6QpuiWmV84WyNLPg591V+stb6q6sqMuUKYmIwoGjfvJ bTcBTVUZ0Jp4WyrETNQ/FhpwZoi37dugw/6v4f6U/4shymoJz+ZIDDgwZlX8zUkwRHk3 bNK1PR0gJZtEZnL0Un2ZK9TPM+pVzq/HF1W18HaMjGJJV7lROA52kCKkuIjqY/xKr/nH V9CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rZv9zF57; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id m11-20020a63fd4b000000b00570505c5267si5936025pgj.262.2023.10.13.23.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 23:58:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rZv9zF57; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A83DA818450E; Fri, 13 Oct 2023 23:58:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232326AbjJNG6W (ORCPT + 99 others); Sat, 14 Oct 2023 02:58:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjJNG6V (ORCPT ); Sat, 14 Oct 2023 02:58:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 637E4BB; Fri, 13 Oct 2023 23:58:19 -0700 (PDT) Date: Sat, 14 Oct 2023 08:58:13 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697266697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sN/M4L6Q9tZIGosWFp/kcGmAa2Y/6EWiUPwyWfd8rKE=; b=rZv9zF571294pKPYQEo+flX23oNTcz7yICfujI8U7SWOjEeeQU2OGHKTocOVg8qTK6qRuE 0mn5Ec8Hq/nbnU5rIKwT4ogtLCW0nFDa8cyMkdijXM0yc0Eioe0gPdIowLOGiYSwXokVYq JsJFUPuNvBFy/bm/4YQInOd+cPaMDL5iPBnMOraBIafXrx3KcfFMiT0Xi+RzKI+1Tczx7d 8HTp1qamuebvdSiUlwMZBbD/5nQsjnqSHWMK41UodMJXMHkyGTn9rN70xZ8k5NCEnjocBI L64bjgO9iLDM7p0H6zdkODOX5RXAf1OA6pGbMvr1r4DbgU6Ifhftp6df1uyDKA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697266697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sN/M4L6Q9tZIGosWFp/kcGmAa2Y/6EWiUPwyWfd8rKE=; b=zI/SGN9WX+UWpuGElmwJn8VnnTpxCeZTQAIXKLSxcDwJO/92htVLVxVMct33PGHEzHMWny OIte2F/uIaH8oAAw== From: Nam Cao To: Gilbert Adikankwu Cc: outreachy@lists.linux.dev, manishc@marvell.com, GR-Linux-NIC-Dev@marvell.com, coiby.xu@gmail.com, gregkh@linuxfoundation.org, netdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: qlge: Add bool type to qlge_idc_wait() Message-ID: <20231014065813.mQvFyjWb@linutronix.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 13 Oct 2023 23:58:41 -0700 (PDT) On Sat, Oct 14, 2023 at 07:11:59AM +0100, Gilbert Adikankwu wrote: > Reported by checkpatch: > > WARNING: else is not generally useful after a break or return > What checkpatch is telling you here is that the "else" is redundant and can be removed. Although your patch suppresses the warning, it makes the code messier :( Best regards, Nam > The idea of the break statements in the if/else is so that the loop is > exited immediately the value of status is changed. And returned > immediately. For if/else conditionals, the block to be executed will > always be one of the two. Introduce a bool type variable 's_sig' that > evaluates to true when the value of status is changed within the if/else > block. > > Signed-off-by: Gilbert Adikankwu > --- > drivers/staging/qlge/qlge.h | 1 + > drivers/staging/qlge/qlge_mpi.c | 8 ++++++-- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h > index d0dd659834ee..b846bca82571 100644 > --- a/drivers/staging/qlge/qlge.h > +++ b/drivers/staging/qlge/qlge.h > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > > /* > * General definitions... > diff --git a/drivers/staging/qlge/qlge_mpi.c b/drivers/staging/qlge/qlge_mpi.c > index 96a4de6d2b34..44cb879240a0 100644 > --- a/drivers/staging/qlge/qlge_mpi.c > +++ b/drivers/staging/qlge/qlge_mpi.c > @@ -909,6 +909,7 @@ int qlge_mb_wol_set_magic(struct qlge_adapter *qdev, u32 enable_wol) > static int qlge_idc_wait(struct qlge_adapter *qdev) > { > int status = -ETIMEDOUT; > + bool s_sig = false; > struct mbox_params *mbcp = &qdev->idc_mbc; > long wait_time; > > @@ -934,14 +935,17 @@ static int qlge_idc_wait(struct qlge_adapter *qdev) > } else if (mbcp->mbox_out[0] == AEN_IDC_CMPLT) { > netif_err(qdev, drv, qdev->ndev, "IDC Success.\n"); > status = 0; > - break; > + s_sig = true; > } else { > netif_err(qdev, drv, qdev->ndev, > "IDC: Invalid State 0x%.04x.\n", > mbcp->mbox_out[0]); > status = -EIO; > - break; > + s_sig = true; > } > + > + if (s_sig) > + break; > } > > return status; > -- > 2.34.1 >