From patchwork Tue Feb 2 21:13:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 61046 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp985694lbb; Tue, 2 Feb 2016 13:16:34 -0800 (PST) X-Received: by 10.98.13.150 with SMTP id 22mr50169798pfn.143.1454447794099; Tue, 02 Feb 2016 13:16:34 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id q14si4078467pfa.60.2016.02.02.13.16.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2016 13:16:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQiIU-00035F-BK; Tue, 02 Feb 2016 21:15:38 +0000 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQiHW-0001Bx-4u for linux-arm-kernel@lists.infradead.org; Tue, 02 Feb 2016 21:14:40 +0000 Received: by mail-pf0-x22d.google.com with SMTP id 65so566203pfd.2 for ; Tue, 02 Feb 2016 13:14:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YgMHPooNTEEgV/AGMSCehNecAIJr93AK9JuYNjD4EMM=; b=CZr5vmmmsj81lhs6UWSj/FZz8Syk2nxSBGDN0tEG6jKzMp34RzOvEQHIJeVmc3gR5M WzKIEv7R1q50ZI8FL/Pyc68++JrPMbieGQD4WRj5VtgyAF+vopIFv+oquF0TVwj6SXrh iH+BlZEk4RNbDiFSdjYdb6TP1sh9ZB7ULQqZs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YgMHPooNTEEgV/AGMSCehNecAIJr93AK9JuYNjD4EMM=; b=FKt5LpmXUPuh68SxmbABdcNp69VqfqBL2ToM1xgRc1WlQi9u4v6fjMRtRZXq3K7QzM zrA+zvEOLMSaCGqm9fAYU3CZzNz+rLdluzXcbkLLfU8L40WE6BWpJyehVVzI0Wv1S6Oo 77AIIhpM7qFQla6/8ynO1DmwcEw99VvqGf6lLjgDKfgCvrMYgQyTwGx4EcfIw3NxYzMB 7852yMEujqyLar2Hxcs/6xt5njbAxNsE8GmT/wAE4ffnFiwXaEd5CPSp35L/EEMkbTkE Nvh51kl7iYEcY8fvcHS6c4kZM4gvbAAZkz+/AaQsy/EKHdy6kArfwosTLZ5pFFmWIPFP NKug== X-Gm-Message-State: AG10YOQHaQp7lHkPcG4PbZdASlXdU89ovdIcOoixrfK2fx49rN65J67sG/IcfIW2jjUAnd60 X-Received: by 10.98.10.65 with SMTP id s62mr18246635pfi.119.1454447657451; Tue, 02 Feb 2016 13:14:17 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id 79sm4769141pfr.22.2016.02.02.13.14.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Feb 2016 13:14:16 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 3/7] coresight: coresight_unregister() function cleanup Date: Tue, 2 Feb 2016 14:13:57 -0700 Message-Id: <1454447641-29153-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454447641-29153-1-git-send-email-mathieu.poirier@linaro.org> References: <1454447641-29153-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160202_131438_425140_CFBCF325 X-CRM114-Status: GOOD ( 13.38 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c00:0:0:0:22d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org In its current form the code never frees csdev->refcnt allocated in coresight_register(). There is also a problem with csdev->conns that is freed before device_unregister() rather than in the device release function. This patch addresses both issues by moving kfree(csdev->conns) to coresight_device_release() and freeing csdev->refcnt, also in the same function. Reported-by: Rabin Vincent Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 41b42018b660..8872db4410eb 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -481,6 +481,8 @@ static void coresight_device_release(struct device *dev) { struct coresight_device *csdev = to_coresight_device(dev); + kfree(csdev->conns); + kfree(csdev->refcnt); kfree(csdev); } @@ -713,7 +715,6 @@ EXPORT_SYMBOL_GPL(coresight_register); void coresight_unregister(struct coresight_device *csdev) { - kfree(csdev->conns); device_unregister(&csdev->dev); } EXPORT_SYMBOL_GPL(coresight_unregister);