Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5763969iog; Thu, 23 Jun 2022 05:03:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tVLVPegs56vKcZXKmPgI/i8uAjWNCZ5NJhk8C+WNdQrAwUnG8ZuVDSrn9W1p2A7DdyGQIE X-Received: by 2002:a05:6402:32a2:b0:435:8b5a:4081 with SMTP id f34-20020a05640232a200b004358b5a4081mr10254061eda.232.1655985800956; Thu, 23 Jun 2022 05:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655985800; cv=none; d=google.com; s=arc-20160816; b=GrEV0fgfi95Sz5OiDWNaCMcNIv5lf9bqgTpPCQsB1V2RY38oSs4eeJwumq1WX7CxYG Yq4QUmr57Sw9yufbj4IC07j6zTeU9cYBPjwr+fVN9IIVxAmu3tMjVnuMKTAJi6Ln5p23 0g28hwh96DG4vud23a+8SW4IIfkHtEVYNz3wr9NRTrM3DfNTgfybp3D/ZHpJgdkmohN4 oHJ4BeFVF7Ki3k4Zq8jQKJgSmmFnWld06kRD3N2l7unvN8YRc841cqGYSN1inDr2sN5H gvztu3iSmuPp0cKhf20m9Xzsi+NBcwf9nfa38Pp6/uBEaa3Ea8w14BCbw0hfBD/gCLXh 9PWA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YS2MbAjvYRNZqGXRyZrOpXBOZY0GFS+NAd6Ab+CTXHE=; b=BLWC5X0IXcaiu4eZNdSbNZAUO3qnOg/9aYgmlbwbKuwNOF4K7rpSpSAjnlv2UPeKhi yQwxChWGA02cwy8qreknfsQ3EkriwBMUqad7gV163NIV1gNzmOasV31hHl5vRlVFZ6tL 3DoM37upDXL4Z1iyLfYlEhX0fF+rMq5z2DjUUr4wgvSxfg/NLN9DRLcEd+u57IkqKuQD BMg8hXDIIqUu3l6mEaYf2DMoXMo2wrBFqO8qeOCRi/Iz6mJbFDb5ZqBbSmOsmRZM4/GO Cjjcp035i9Yyfr9ActIbvz2bmQsVL7lis2V1B8U+0yE4ajtpE8qquOM9zeFEdEPxFVVO +/7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Oy1Xox+f; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a056402424a00b0043378facf6csi8077892edb.144.2022.06.23.05.02.44; Thu, 23 Jun 2022 05:03:20 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=Oy1Xox+f; 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 S230482AbiFWL5o (ORCPT + 99 others); Thu, 23 Jun 2022 07:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231630AbiFWL51 (ORCPT ); Thu, 23 Jun 2022 07:57:27 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00A554D614; Thu, 23 Jun 2022 04:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655985445; x=1687521445; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ce43flTutdWp+lJ4X2FWdJd4XMwCf5ChCFOwzmnicV8=; b=Oy1Xox+fe6er+VthNJppUZSxy/ov+pys5nPlQavM3J6FySXGoI19sgMC vOy7fGqhBTno8o6pF9Gr9uKFmEUjocIr+/xOE7GIUKOYdg3XEDpUzpj+r 79EjKrDlCLYrubUB8zQRwWzvIV6C7ryhIM356UvcdXCMti/6BLqcUJsGH Wu2orW3omclFEApH8MZ3mW/XlRILIl/Kh0lnQt5ZCQSXAqM1Nu248ImJm ZQ/cM7htuSln6uH8O3P00UOyVX7sdOFUfM5BK54UFmCo7t4i1b9KHQGKI VyBKgH76dLednk8WKxVhCzgi0+aoyVfUUud4rO/2+u7lc/W1RSf8qe7os w==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="281776426" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="281776426" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 04:57:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="644704180" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 23 Jun 2022 04:57:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3A458152; Thu, 23 Jun 2022 14:57:26 +0300 (EEST) From: Andy Shevchenko To: Stephen Boyd , Andy Shevchenko , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Michael Turquette , Russell King Subject: [PATCH v1 3/3] clkdev: Simplify devm_clk_hw_register_clkdev() function Date: Thu, 23 Jun 2022 14:57:19 +0300 Message-Id: <20220623115719.52683-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220623115719.52683-1-andriy.shevchenko@linux.intel.com> References: <20220623115719.52683-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org Use devm_add_action_or_reset() instead of devres_alloc() and devres_add(), which works the same. This will simplify the code. There is no functional changes. Signed-off-by: Andy Shevchenko --- drivers/clk/clkdev.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 716bb1710b89..b5eed37dc71a 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -348,9 +348,9 @@ int clk_hw_register_clkdev(struct clk_hw *hw, const char *con_id, } EXPORT_SYMBOL(clk_hw_register_clkdev); -static void devm_clkdev_release(struct device *dev, void *res) +static void devm_clkdev_release(void *res) { - clkdev_drop(*(struct clk_lookup **)res); + clkdev_drop(res); } /** @@ -371,17 +371,13 @@ static void devm_clkdev_release(struct device *dev, void *res) int devm_clk_hw_register_clkdev(struct device *dev, struct clk_hw *hw, const char *con_id, const char *dev_id) { - int rval = -ENOMEM; - struct clk_lookup **cl; - - cl = devres_alloc(devm_clkdev_release, sizeof(*cl), GFP_KERNEL); - if (cl) { - rval = do_clk_register_clkdev(hw, cl, con_id, dev_id); - if (!rval) - devres_add(dev, cl); - else - devres_free(cl); - } - return rval; + struct clk_lookup *cl; + int rval; + + rval = do_clk_register_clkdev(hw, &cl, con_id, dev_id); + if (rval) + return rval; + + return devm_add_action_or_reset(dev, devm_clkdev_release, cl); } EXPORT_SYMBOL(devm_clk_hw_register_clkdev); -- 2.35.1