From patchwork Thu Oct 2 07:53:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 5016721 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 579E7BEEA6 for ; Thu, 2 Oct 2014 07:54:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8934920279 for ; Thu, 2 Oct 2014 07:54:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 85F602026F for ; Thu, 2 Oct 2014 07:54:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752152AbaJBHxt (ORCPT ); Thu, 2 Oct 2014 03:53:49 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:48366 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751074AbaJBHxq (ORCPT ); Thu, 2 Oct 2014 03:53:46 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s927rgSG013682; Thu, 2 Oct 2014 02:53:42 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s927rgQg022659; Thu, 2 Oct 2014 02:53:42 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Thu, 2 Oct 2014 02:53:41 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s927re4t007803; Thu, 2 Oct 2014 02:53:41 -0500 From: Jyri Sarha To: , , Mike Turquette , CC: , , Jyri Sarha Subject: [PATCH 1/2] clk: gpio-gate: Stop using devres API Date: Thu, 2 Oct 2014 10:53:31 +0300 Message-ID: <59d52e97a4954e0593a9aebc5b7d0d968a10f485.1412234778.git.jsarha@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If some driver calls clk_register_gpio_gate() directly, then the driver needs to kfree the resulting struct clk pointer in remove function. Signed-off-by: Jyri Sarha --- drivers/clk/clk-gpio-gate.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/clk/clk-gpio-gate.c b/drivers/clk/clk-gpio-gate.c index b87e5f0..a648761 100644 --- a/drivers/clk/clk-gpio-gate.c +++ b/drivers/clk/clk-gpio-gate.c @@ -82,23 +82,14 @@ struct clk *clk_register_gpio_gate(struct device *dev, const char *name, else gpio_flags = GPIOF_OUT_INIT_LOW; - if (dev) - err = devm_gpio_request_one(dev, desc_to_gpio(gpiod), - gpio_flags, name); - else - err = gpio_request_one(desc_to_gpio(gpiod), gpio_flags, name); - + err = gpio_request_one(desc_to_gpio(gpiod), gpio_flags, name); if (err) { pr_err("%s: %s: Error requesting clock control gpio %u\n", __func__, name, desc_to_gpio(gpiod)); return ERR_PTR(err); } - if (dev) - clk_gpio = devm_kzalloc(dev, sizeof(struct clk_gpio), - GFP_KERNEL); - else - clk_gpio = kzalloc(sizeof(struct clk_gpio), GFP_KERNEL); + clk_gpio = kzalloc(sizeof(struct clk_gpio), GFP_KERNEL); if (!clk_gpio) { clk = ERR_PTR(-ENOMEM); @@ -119,8 +110,7 @@ struct clk *clk_register_gpio_gate(struct device *dev, const char *name, if (!IS_ERR(clk)) return clk; - if (!dev) - kfree(clk_gpio); + kfree(clk_gpio); clk_register_gpio_gate_err: gpiod_put(gpiod);