Message ID | 20221114170006.61751-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2253554wru; Mon, 14 Nov 2022 09:03:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iXXZmDCWc4E1IWiVrQ2MiPFMc2AcTYawgudGY/CG2ksIHEsRZhXWAk7xEN7+MGcbgFvGp X-Received: by 2002:a17:90a:5801:b0:209:46fe:871b with SMTP id h1-20020a17090a580100b0020946fe871bmr14647956pji.163.1668445401921; Mon, 14 Nov 2022 09:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445401; cv=none; d=google.com; s=arc-20160816; b=XYbpFV/Ki710spWnGdfJloRm0Vr95vTWJ+uuwq4YxT8ReBxjeUmzPy14ba1gC0Prrd ZW9HQ8piKqDR3wL8yjOocZ2Tdvimc8ybqZl1OPxN7ey9Z/1UddwR661QFDHC0TXb0Lbg YCcqHLzUjSM9agRRXEbm1NM8SYwODoPzsw9QpY3hEd7NEgg/9zwTu9vUivVY1L4EARvd nZlQYk1NAMqS+JyvO4iKFTQwhE83mGVPwHMbG/J+a2u7N+kTWsRyHXByUcp0olnQTrlY Fjyn4set0pde1s8AmKOLN36hr4R78Vw32TPQgRVrrOcX15gbKO3UnmsvmJr1/vuit1ZU K2vA== 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:dkim-signature; bh=W7LSw86hdWHXCbVrd8DpylXy5x03GJG2MtwYWbSM/6U=; b=kWHhnp83+Yb3LLjjbswqtJkE9fzI217lQYWfvNWs8KHb/pjO/0c39d4SdsKznh+/2A xygeAk8nUxjRZRq11qQRP2fSfPsN4vO+UlDE4zxywUIqxHeO8Jqtp8DCGok2+kKw9UzT eV4MTWbKW4wDPp/glVBlEAbNj0ZmEni49CN8R+vDVUo+b/EEvMuZsfgUhoPqUMbcozm2 of2hEVT1CJ124VZHPJ7jAVMypj9Lg5pKmLNEZ5U1RhL9jgq83E25SZpDsiEu7D+l8tgC gzGgA9KYIc3VHI+MY0OZxns3D/QHeKvpQtnSRkxDIW61h7Y4RAbiLs1CkuaXxSvHwL+F LIFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RWmd5IFZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a1709027c8c00b00186e9ff4edcsi9162592pll.408.2022.11.14.09.03.05; Mon, 14 Nov 2022 09:03:21 -0800 (PST) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=RWmd5IFZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238139AbiKNRAx (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Mon, 14 Nov 2022 12:00:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238116AbiKNRAQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 12:00:16 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A516B31DE7; Mon, 14 Nov 2022 08:59:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668445184; x=1699981184; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=B3cccWBw0rMFOaKNnRwHvr376JFvt2Uj98KrwSkBaa8=; b=RWmd5IFZxSSLu3KpR4NPOjs0IiqHO+JbMH2N9ovQTSHeYdHXoxkMiBn3 uIOq7Elm+ptOkkKxyb0HFT+1Lz7aIG8ddgd74v2vUyJlQ/11M+zmGwzJy e/mottGIogrIf1ratkBzwyIXxHbfSh+P6BH9ddRggqxupWFoo9n6aterX 4cjNzFGQjneHoQ8hxBxx4VbTkL4LYLch+rqnKHysYpPfrYI59EkDNlMZh neUBtCgibp4435Z2krXvQDgz6iJoT81VRR5zwtrzi/6laKo8x8ibvpUMw ltKTZMPKNPu5LE3DoHsqIewkUYz8CBXD14gCbyUheTTfDx+YEVOiPMpOc A==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="313168848" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="313168848" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:59:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="727595259" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="727595259" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 14 Nov 2022 08:59:42 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E9D382F3; Mon, 14 Nov 2022 19:00:06 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thierry Reding <thierry.reding@gmail.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Subject: [PATCH v2 1/2] pwm: core: Refactor pwmchip_add() to avoid extra checks Date: Mon, 14 Nov 2022 19:00:04 +0200 Message-Id: <20221114170006.61751-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749491805915818372?= X-GMAIL-MSGID: =?utf-8?q?1749491805915818372?= |
Series |
[v2,1/2] pwm: core: Refactor pwmchip_add() to avoid extra checks
|
|
Commit Message
Andy Shevchenko
Nov. 14, 2022, 5 p.m. UTC
When we already know that everything is fine there is no need
to use ret variable. Refactor code accordingly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: rebased with dropped wrong patch (LKP)
drivers/pwm/core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Comments
Hello, On Mon, Nov 14, 2022 at 07:00:04PM +0200, Andy Shevchenko wrote: > When we already know that everything is fine there is no need > to use ret variable. Refactor code accordingly. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> The patch is correct (i.e. doesn't change the semantic of the function). But I think there is some more potential to clean up than it used here. I will send out a series that I like better than this patch. Best regards Uwe
On Tue, Nov 15, 2022 at 09:24:12PM +0100, Uwe Kleine-König wrote: > On Mon, Nov 14, 2022 at 07:00:04PM +0200, Andy Shevchenko wrote: > > When we already know that everything is fine there is no need > > to use ret variable. Refactor code accordingly. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > The patch is correct (i.e. doesn't change the semantic of the function). > > But I think there is some more potential to clean up than it used here. > I will send out a series that I like better than this patch. Fine, can you attach the second patch of this series to yours v2, please?
On Wed, Nov 16, 2022 at 10:22:56AM +0200, Andy Shevchenko wrote: > On Tue, Nov 15, 2022 at 09:24:12PM +0100, Uwe Kleine-König wrote: > > On Mon, Nov 14, 2022 at 07:00:04PM +0200, Andy Shevchenko wrote: > > > When we already know that everything is fine there is no need > > > to use ret variable. Refactor code accordingly. > > > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > > > The patch is correct (i.e. doesn't change the semantic of the function). > > > > But I think there is some more potential to clean up than it used here. > > I will send out a series that I like better than this patch. > > Fine, can you attach the second patch of this series to yours v2, please? These are independant cleanups. I suggest that Thierry just picks up the other patch in this series (assuming of course he is OK with it). Best regards Uwe
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index d333e7422f4a..855abd0a776f 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -296,16 +296,16 @@ int pwmchip_add(struct pwm_chip *chip) INIT_LIST_HEAD(&chip->list); list_add(&chip->list, &pwm_chips); - ret = 0; - if (IS_ENABLED(CONFIG_OF)) of_pwmchip_add(chip); -out: mutex_unlock(&pwm_lock); - if (!ret) - pwmchip_sysfs_export(chip); + pwmchip_sysfs_export(chip); + + return 0; +out: + mutex_unlock(&pwm_lock); return ret; }