From patchwork Tue Jul 3 11:47:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 9789 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 A51C223E2F for ; Tue, 3 Jul 2012 12:00:23 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 734EFA183D2 for ; Tue, 3 Jul 2012 12:00:23 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so5586936ggn.11 for ; Tue, 03 Jul 2012 05:00:23 -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=bEz2x+K5bEpqAqWqvX2T1DVDVuojuN4vpBXBGY8jMws=; b=UumZNVujndutyfjr/jH/dVm8FsPg3A2VIo+E+zEJPcqvwJRYFfuBdAbxaD/ewfzJBw qOnmJre0kWXkIKmmkFiK0gb9yfGMAvetSta77e9IkscRFDOWdppcmm/hm6jp+E4RVDgh GXnOC5Cbmz4gDiOCUsGQQ704/meKWnxxaFGS3uI4e1r/fJLWa+BbeKQ5BdFf4OHRpgQN WjhV5cIi0TUoiIcGxzd1qFhcVV6F5iX32uV0BQCje4lEyqml6gxI1vrEHI88NxHvrZ2C pPBUSeUDr4nsU/vZ2Xuug3nkIIwEmAZHO7HdUFBO+7TVoRCetPPWKZlkQssQos7ywQQL DbDQ== Received: by 10.50.40.193 with SMTP id z1mr10065310igk.0.1341316823078; Tue, 03 Jul 2012 05:00:23 -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 v20csp38792ibb; Tue, 3 Jul 2012 05:00:22 -0700 (PDT) Received: by 10.68.230.68 with SMTP id sw4mr6543652pbc.142.1341316822186; Tue, 03 Jul 2012 05:00:22 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id ms9si23919143pbb.102.2012.07.03.05.00.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 05:00:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pb0-f50.google.com with SMTP id rr4so10881159pbb.37 for ; Tue, 03 Jul 2012 05:00:22 -0700 (PDT) Received: by 10.68.228.39 with SMTP id sf7mr6532140pbc.45.1341316821926; Tue, 03 Jul 2012 05:00:21 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id oo6sm15466531pbc.22.2012.07.03.05.00.17 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 05:00:21 -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 3/5] leds: Use devm_kzalloc in leds-gpio.c file Date: Tue, 3 Jul 2012 17:17:52 +0530 Message-Id: <1341316074-14886-3-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: ALoCoQmyohvQm2Bgv+S3FNL9hReuCBlC1rlBpOsCZlVGBQ863KZ7oGAouwc0hp2uEgVJXeWU67tU devm_kzalloc() makes cleanup simpler. Signed-off-by: Sachin Kamat --- drivers/leds/leds-gpio.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index f4c470a..23b49a4 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -239,8 +239,9 @@ static int __devinit gpio_led_probe(struct platform_device *pdev) int i, ret = 0; if (pdata && pdata->num_leds) { - priv = kzalloc(sizeof_gpio_leds_priv(pdata->num_leds), - GFP_KERNEL); + priv = devm_kzalloc(&pdev->dev, + sizeof_gpio_leds_priv(pdata->num_leds), + GFP_KERNEL); if (!priv) return -ENOMEM; @@ -253,7 +254,6 @@ static int __devinit gpio_led_probe(struct platform_device *pdev) /* On failure: unwind the led creations */ for (i = i - 1; i >= 0; i--) delete_gpio_led(&priv->leds[i]); - kfree(priv); return ret; } } @@ -277,7 +277,6 @@ static int __devexit gpio_led_remove(struct platform_device *pdev) delete_gpio_led(&priv->leds[i]); dev_set_drvdata(&pdev->dev, NULL); - kfree(priv); return 0; }