From patchwork Wed Nov 27 15:39:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 3248931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 46C2B9F3A0 for ; Wed, 27 Nov 2013 16:02:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33088205B9 for ; Wed, 27 Nov 2013 16:02:12 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D93EB200E6 for ; Wed, 27 Nov 2013 16:02:10 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VlhZ0-0001j3-84; Wed, 27 Nov 2013 16:02:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VlhYx-0000fy-KR; Wed, 27 Nov 2013 16:02:03 +0000 Received: from mail-ie0-f179.google.com ([209.85.223.179]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VlhYv-0000f4-AM for linux-arm-kernel@lists.infradead.org; Wed, 27 Nov 2013 16:02:01 +0000 Received: by mail-ie0-f179.google.com with SMTP id x13so11803815ief.24 for ; Wed, 27 Nov 2013 08:01:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=heG5pUFy1wChLQmaZAvBxJYP1Mg5LsLcW3yM7CR8PRM=; b=dkJCIqCfM51ODx6zSyKW2ZwDTVEfHMFTIgS/i3SXt/dYpng5xDjv4ycoWq8fIHumgH GezMn3BIzWg0WrD7QzzsA5SgKfs/BHIgfxtt6Sz6UwCyytOish2k0WXJ8uadSSujiyC9 p+qfm9094ZG6IFYilZy1i//hBzE4ty1VNmxJiXezyN3DwpEzDlYFqbJ7kGLQA3sU5/c+ abrEzC4ZDuCrVIgZ8klMzM9Em/7xazQt4INoA27miAC+HIv2lu1+Gp6ajkVzQH1IoBeu LM86Ls+D9iapEicd3L63TRKicx30FdPwm0ALjDeJ1Ev4YoOPoJbQtQNtIT21vFdfKHdp NtZw== X-Gm-Message-State: ALoCoQlBGOAQI2xtLJC1sttWl17FEdZxayJXYIXIkejPUza3QDMC82szRweiJM99UBPxU+KNB4EW X-Received: by 10.42.46.80 with SMTP id j16mr388360icf.94.1385566790542; Wed, 27 Nov 2013 07:39:50 -0800 (PST) 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 s4sm2085069ige.0.2013.11.27.07.39.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Nov 2013 07:39:49 -0800 (PST) Message-ID: <52961245.4010504@linaro.org> Date: Wed, 27 Nov 2013 09:39:49 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Mike Turquette Subject: [PATCH RESEND AGAIN] clk: clean up everything on debugfs error X-Enigmail-Version: 1.5.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131127_110201_381690_9800399E X-CRM114-Status: GOOD ( 12.02 ) X-Spam-Score: -2.6 (--) Cc: LKML , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 [Maybe the third time will be the charm. -Alex] 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 2cf2ea6..77fcd06 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;