From patchwork Wed Jun 20 12:56:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 9496 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D97CC23E1B for ; Wed, 20 Jun 2012 12:57:17 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id A836FA182F0 for ; Wed, 20 Jun 2012 12:57:17 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so6181466yhp.11 for ; Wed, 20 Jun 2012 05:57:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=4Xs6Oa4fKBwAnuzOka2Gbqnfvbd+GqA0lfPrnNo6hlg=; b=jszQMW3FjTYJmunnxOk5lQ0aN4BwZ6PclOP9i/PvaHWO04rktgyvhrb5yDXgiXiwmp i4y83gjiww0yiIS6hJ8T+Uk6J0rN8Ahfh+iL7ozZ38ccgL3/ClKUGag/4A1nPY87YXuX oWQkKNIZye96v2JxCg3bn77BxYxDy5gTeOVFld4/YiHrBkgb+oK5HD08vAoUVW/kXiuI p+MaaQbdumVmr0T7D9xKnT02Fcwiab2idtdvcfBLqpEe2oAdmyG8PBbCGIGgvR2NIFgI sYw/WqqcVqp7WUlI26okcQUaluVRcDuv9Ym5FaxZ4jeoXz0pzHaquBqq21hkvxIN1O7F Ugdg== Received: by 10.50.160.198 with SMTP id xm6mr4439721igb.0.1340197037268; Wed, 20 Jun 2012 05:57:17 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp178547ibb; Wed, 20 Jun 2012 05:57:16 -0700 (PDT) Received: by 10.180.105.234 with SMTP id gp10mr11920679wib.11.1340197035775; Wed, 20 Jun 2012 05:57:15 -0700 (PDT) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id n13si28848410wee.108.2012.06.20.05.57.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 05:57:15 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f178.google.com with SMTP id f13so5152523wer.37 for ; Wed, 20 Jun 2012 05:57:15 -0700 (PDT) Received: by 10.216.62.66 with SMTP id x44mr12664605wec.80.1340197035209; Wed, 20 Jun 2012 05:57:15 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id gc6sm38878374wib.0.2012.06.20.05.57.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 05:57:14 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org Cc: linus.walleij@stericsson.com, arnd@arndb.de, grant.likely@secretlab.ca, linux@arm.linux.org.uk, broonie@opensource.wolfsonmicro.com, Lee Jones Subject: [PATCH 09/15] pinctrl: pinctrl-nomadik: Fix possible memory leak Date: Wed, 20 Jun 2012 13:56:45 +0100 Message-Id: <1340197011-5435-10-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1340197011-5435-1-git-send-email-lee.jones@linaro.org> References: <1340197011-5435-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnc947ZUn43H2a+RFev/xOOnCrX3JKboPvk0hfbeFdzaJmLvgNdpp1qChLmMhNbcdq+ljuH If the Nomadik Pin Control driver is continuously bound and unbound from the same device a number of times the kzalloc() will leak memory. Replacing it with devm_kzalloc() will ensure memory is freed automatically in the event of failure and unbinding. Signed-off-by: Lee Jones --- drivers/pinctrl/pinctrl-nomadik.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index b26395d..e297499 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c @@ -1194,7 +1194,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) } if (np) { - pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); + pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) return -ENOMEM;