Message ID | 20230715182428.3348-1-kunyu@nfschina.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2217931vqm; Thu, 13 Jul 2023 19:11:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlEXumJxUmxrP6qs7C2CqXL1DAgGwjcZwvDv8DDoo2Poh+xa2OcKmb9UE4kW1eECWSkfWlGp X-Received: by 2002:a05:6a21:32a7:b0:131:3598:f4e7 with SMTP id yt39-20020a056a2132a700b001313598f4e7mr2867561pzb.33.1689300705536; Thu, 13 Jul 2023 19:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689300705; cv=none; d=google.com; s=arc-20160816; b=yrfMs1NoXMMOEIvlIbT+iZVVcRxe0V13hNsDdyvEGuXcJ3KFgbmAqDda4rt+vHBb3N JZtKRd9O4pgLz1Xxd1UfYaqfsEB5oOnutahDbQaVRW279WArSGnL8DuVMtV1bKrrzJWB KgqEI0iVaJt18PE1BWSIA/4vx+CqfVnaoPc/ML0JCAfkHWW38w7X/7PeC+l3mJVIXAa+ ystCKZ0zGSCuvsciQS/E4R/V80vsykw51LCBB04CKcfsQUB+6Xus03b3bgt9pBCDLp05 KWH7QvFqrBlHq0VLyuL510hisELdQgx9T1qGWo6+o26tjq1hdk+oGVgmfM8hEnh6f4BX gDtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Uvq7xqAlTziYBwghXDw6XeKb9vxhx8BCjFYkWi3BKFo=; fh=B29nbZ043V249A7OLHSzS9n6o0vPJ/6fTkMNWMfPXug=; b=c/BeGMR8UfKmcHGdT0ckFsVxTCw4Nli72q7e41HOhGjMrqQQhTMTJBpNI/kBCm86HF trbM9FCeNJbgMa+hueHdb6/gpbKjMUN9CMuRuQFbGEzild5gDXe1pfw3loQB6bKHTEpb eabdhEQEHKxQ7QMeOssNz4tUOP2AP7XrnBwZ8lmWCVP0AihKpgCUq6Z+PNKFJuv6SSAH Zokh8F5dbfE1ypEKcWmdru1RrzKvvxyR4E+yWtLe/ITGJrrB/DjBaEXVPty+qhmYdhR6 suld0cufOcxihY2Eny0Kb5DPnRf0JxnHxM7/73Fhhwpy++JolNo/Rxctm08BB6+ewXAX lpLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a170902db0e00b001baff05d8a0si3420917plx.248.2023.07.13.19.11.32; Thu, 13 Jul 2023 19:11:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234348AbjGNBxi (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Thu, 13 Jul 2023 21:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234317AbjGNBxg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Jul 2023 21:53:36 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 0E65E2D60 for <linux-kernel@vger.kernel.org>; Thu, 13 Jul 2023 18:53:30 -0700 (PDT) Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 151E86062C7C7; Fri, 14 Jul 2023 09:53:09 +0800 (CST) X-MD-Sfrom: kunyu@nfschina.com X-MD-SrcIP: 219.141.250.2 From: Li kunyu <kunyu@nfschina.com> To: dan.j.williams@intel.com, gregkh@linuxfoundation.org, Jonathan.Cameron@huawei.com, ira.weiny@intel.com, bhelgaas@google.com, andriy.shevchenko@linux.intel.com Cc: linux-kernel@vger.kernel.org, Li kunyu <kunyu@nfschina.com> Subject: [PATCH v2] =?utf-8?q?kernel=3A_resource=3A_Remove_unnecessary_?= =?utf-8?q?=E2=80=980=E2=80=99_values_from_err?= Date: Sun, 16 Jul 2023 02:24:28 +0800 Message-Id: <20230715182428.3348-1-kunyu@nfschina.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.9 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_24_48, RCVD_IN_DNSWL_BLOCKED,RDNS_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771360176635297686 X-GMAIL-MSGID: 1771360176635297686 |
Series |
[v2] kernel: resource: Remove unnecessary ‘0’ values from err
|
|
Commit Message
Li kunyu
July 15, 2023, 6:24 p.m. UTC
err is assigned first, so it does not need to initialize the assignment.
Modify __find_resource execution syntax to make it more in line with
commonly used styles.
Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
v2:
Modify __find_resource Execution Syntax.
kernel/resource.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On 7/15/23 11:24, Li kunyu wrote: > err is assigned first, so it does not need to initialize the assignment. > Modify __find_resource execution syntax to make it more in line with > commonly used styles. > > Signed-off-by: Li kunyu <kunyu@nfschina.com> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Thanks. > --- > v2: > Modify __find_resource Execution Syntax. > > kernel/resource.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel/resource.c b/kernel/resource.c > index b1763b2fd7ef..ee79e8f4f422 100644 > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -656,13 +656,14 @@ static int reallocate_resource(struct resource *root, struct resource *old, > resource_size_t newsize, > struct resource_constraint *constraint) > { > - int err=0; > + int err; > struct resource new = *old; > struct resource *conflict; > > write_lock(&resource_lock); > > - if ((err = __find_resource(root, old, &new, newsize, constraint))) > + err = __find_resource(root, old, &new, newsize, constraint); > + if (err) > goto out; > > if (resource_contains(&new, old)) {
On Sun, Jul 16, 2023 at 02:24:28AM +0800, Li kunyu wrote: > err is assigned first, so it does not need to initialize the assignment. > Modify __find_resource execution syntax to make it more in line with > commonly used styles. FWIW, Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Signed-off-by: Li kunyu <kunyu@nfschina.com> > --- > v2: > Modify __find_resource Execution Syntax. > > kernel/resource.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel/resource.c b/kernel/resource.c > index b1763b2fd7ef..ee79e8f4f422 100644 > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -656,13 +656,14 @@ static int reallocate_resource(struct resource *root, struct resource *old, > resource_size_t newsize, > struct resource_constraint *constraint) > { > - int err=0; > + int err; > struct resource new = *old; > struct resource *conflict; > > write_lock(&resource_lock); > > - if ((err = __find_resource(root, old, &new, newsize, constraint))) > + err = __find_resource(root, old, &new, newsize, constraint); > + if (err) > goto out; > > if (resource_contains(&new, old)) { > -- > 2.18.2 >
diff --git a/kernel/resource.c b/kernel/resource.c index b1763b2fd7ef..ee79e8f4f422 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -656,13 +656,14 @@ static int reallocate_resource(struct resource *root, struct resource *old, resource_size_t newsize, struct resource_constraint *constraint) { - int err=0; + int err; struct resource new = *old; struct resource *conflict; write_lock(&resource_lock); - if ((err = __find_resource(root, old, &new, newsize, constraint))) + err = __find_resource(root, old, &new, newsize, constraint); + if (err) goto out; if (resource_contains(&new, old)) {