From patchwork Tue Jul 3 11:47:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 9790 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 0A00A23E2F for ; Tue, 3 Jul 2012 12:00:27 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id CD47EA183D4 for ; Tue, 3 Jul 2012 12:00:26 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so5578605yen.11 for ; Tue, 03 Jul 2012 05:00:26 -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=1rsug1oiql0dW+6j2MbvhkDnoA6KaJRAPXWeb8SiZe4=; b=dfYW0z5apcU4tLYh9WtDt818D4VZpiLCSfrt5uTLmq0Y/ynO57wmziaKUirGPsZjfw EEcl7tXDExv44MTbEiDy6w3KaN8ol8UBvWe6jsBUD+2nz0fdSpc093QIRGoVkpLtqZi0 izfxWDtRfM0M97O8WidBQFx4FxcogwyZ9B07y3XiA6XJ/5cF/iSSzu5aVp54VjMq7S/l yCriHaoEpzOG0+A36CI5UmgdPHIq57KYJo9+1LjOx8njJXxzJ89B6km0jXJS8/f3EGo8 pzV2Zw7s9X389pOunduR88Kgzf6iH8+WNX1LHrr6oJkyRWMPLsk64M1qCIeyu+VxtzQF K83w== Received: by 10.50.163.99 with SMTP id yh3mr7879512igb.53.1341316826514; Tue, 03 Jul 2012 05:00:26 -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 v20csp38794ibb; Tue, 3 Jul 2012 05:00:26 -0700 (PDT) Received: by 10.236.190.168 with SMTP id e28mr19766646yhn.57.1341316825774; Tue, 03 Jul 2012 05:00:25 -0700 (PDT) Received: from mail-gh0-f178.google.com (mail-gh0-f178.google.com [209.85.160.178]) by mx.google.com with ESMTPS id b27si12374735yhn.4.2012.07.03.05.00.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 05:00:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by ghbf1 with SMTP id f1so6118897ghb.37 for ; Tue, 03 Jul 2012 05:00:25 -0700 (PDT) Received: by 10.66.76.34 with SMTP id h2mr28864270paw.16.1341316824943; Tue, 03 Jul 2012 05:00:24 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id oo6sm15466531pbc.22.2012.07.03.05.00.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 05:00:24 -0700 (PDT) From: Sachin Kamat To: linux-leds@vger.kernel.org Cc: bryan.wu@canonical.com, rpurdie@rpsys.net, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 4/5] leds: Use devm_kzalloc in leds-pwm.c file Date: Tue, 3 Jul 2012 17:17:53 +0530 Message-Id: <1341316074-14886-4-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1341316074-14886-1-git-send-email-sachin.kamat@linaro.org> References: <1341316074-14886-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQkKUTUxYnFbvUj44Ad7j48FP5c7x0/geeXWLpSC6OjHyYprpLpNW5konMm0DaLfG/CNuPVs devm_kzalloc() makes cleanup simpler. Signed-off-by: Sachin Kamat --- drivers/leds/leds-pwm.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index 3ed92f3..f2e44c7 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c @@ -57,7 +57,8 @@ static int led_pwm_probe(struct platform_device *pdev) if (!pdata) return -EBUSY; - leds_data = kzalloc(sizeof(struct led_pwm_data) * pdata->num_leds, + leds_data = devm_kzalloc(&pdev->dev, + sizeof(struct led_pwm_data) * pdata->num_leds, GFP_KERNEL); if (!leds_data) return -ENOMEM; @@ -103,8 +104,6 @@ err: } } - kfree(leds_data); - return ret; } @@ -121,8 +120,6 @@ static int __devexit led_pwm_remove(struct platform_device *pdev) pwm_free(leds_data[i].pwm); } - kfree(leds_data); - return 0; }