From patchwork Tue Sep 10 19:30:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 19938 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2BE06246A4 for ; Tue, 10 Sep 2013 19:29:58 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id l13sf4927181qcy.9 for ; Tue, 10 Sep 2013 12:29:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:subject:references:in-reply-to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=Q7NpzwSLN1Ve70qZVFKLd2so8K/povB8Ey+V7yMZ3mM=; b=ELpcnpSrVEY7Z3043RzH6keoGnMxDZ/RGAkxGc9aV0WUAbIfv3+iaAJ7jVfkkOkgeY PA/L0lHKIeO3eWJjeE49Z0EEtkSqsxhvmR9DiRn+3Izsnm2MAwAmrUkvxcybQavAKlKj VY/2qWDmVc9G2cS0mQwhqp4bBup1NKQ89PUdZM1zf0MH1ENmgqRxVobABOAqxmBcxRKS ng7vBlGZ+Ee9QNzleW+6Ie7tSxrdGLYPM/HvKsRCCyeCow5MQ3L4MTLBF3NXXg/lGaQF /cHcnon+5cZYekiTUpa6JGSqbi5jl8DO2cdv/98ilPoXY4y7QoyAxicPI01SplFz2w0Z 8xGw== X-Received: by 10.236.52.228 with SMTP id e64mr4898949yhc.45.1378841398029; Tue, 10 Sep 2013 12:29:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.168 with SMTP id w8ls2301246qeu.64.gmail; Tue, 10 Sep 2013 12:29:57 -0700 (PDT) X-Received: by 10.52.165.131 with SMTP id yy3mr2500297vdb.25.1378841397744; Tue, 10 Sep 2013 12:29:57 -0700 (PDT) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id h13si4848953vco.11.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 12:29:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.51; Received: by mail-vb0-f51.google.com with SMTP id x16so5238454vbf.24 for ; Tue, 10 Sep 2013 12:29:57 -0700 (PDT) X-Gm-Message-State: ALoCoQllfS113WvHAZfMmm90Rn0JjMWW9B5qJtgpma+Be6yPyQq9nQn54yoWZo21UmTNcMnjT2ax X-Received: by 10.220.181.136 with SMTP id by8mr24684603vcb.11.1378841397640; Tue, 10 Sep 2013 12:29:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp16013vcz; Tue, 10 Sep 2013 12:29:57 -0700 (PDT) X-Received: by 10.236.98.42 with SMTP id u30mr3104139yhf.80.1378841396848; Tue, 10 Sep 2013 12:29:56 -0700 (PDT) Received: from mail-ie0-f178.google.com (mail-ie0-f178.google.com [209.85.223.178]) by mx.google.com with ESMTPS id r8si6056936yhb.14.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 12:29:56 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.223.178 is neither permitted nor denied by best guess record for domain of alex.elder@linaro.org) client-ip=209.85.223.178; Received: by mail-ie0-f178.google.com with SMTP id to1so6900132ieb.9 for ; Tue, 10 Sep 2013 12:29:56 -0700 (PDT) X-Received: by 10.50.20.3 with SMTP id j3mr11256802ige.11.1378841396400; Tue, 10 Sep 2013 12:29:56 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id x6sm1934536igb.3.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 12:29:56 -0700 (PDT) Message-ID: <522F733A.6050806@linaro.org> Date: Tue, 10 Sep 2013 14:30:02 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-Version: 1.0 To: patches@linaro.org Subject: Fwd: [PATCH] clk: clean up everything on debugfs error References: <522E57B7.6010603@linaro.org> In-Reply-To: <522E57B7.6010603@linaro.org> X-Enigmail-Version: 1.4.6 X-Forwarded-Message-Id: <522E57B7.6010603@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.elder@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , -------- Original Message -------- Subject: [PATCH] clk: clean up everything on debugfs error Date: Mon, 09 Sep 2013 18:20:23 -0500 From: Alex Elder To: Mike Turquette CC: linux-arm-kernel@lists.infradead.org, LKML If CONFIG_COMMON_CLK_DEBUG is defined, clk_debug_create_one() is called to populate a debugfs directory with a few entries that are common for all clock types. If an error happens after creating the first one debugfs_remove() is called on the clock's directory. The problem with this is that no cleanup is done on the debugfs files already created in that directory, so the directory never actually gets removed. This problem is silently ignored. Fix this by calling debugfs_remove_recursive() instead. Reset the clk->dentry field to null afterward, to ensure it can't be mistaken as a valid pointer. Signed-off-by: Alex Elder --- drivers/clk/clk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) } diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 54a191c..727ae7b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -272,7 +272,8 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry) goto out; err_out: - debugfs_remove(clk->dentry); + debugfs_remove_recursive(clk->dentry); + clk->dentry = NULL; out: return ret;