From patchwork Thu Aug 20 22:12:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 7047201 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3CA999F358 for ; Thu, 20 Aug 2015 22:18:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E8CC20421 for ; Thu, 20 Aug 2015 22:18:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6EBBA205BC for ; Thu, 20 Aug 2015 22:18:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753293AbbHTWSI (ORCPT ); Thu, 20 Aug 2015 18:18:08 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:54355 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752955AbbHTWRw (ORCPT ); Thu, 20 Aug 2015 18:17:52 -0400 Received: from [69.84.245.29] (helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1ZSY9V-0000TV-LB; Thu, 20 Aug 2015 22:17:43 +0000 Received: from broonie by finisterre with local (Exim 4.86) (envelope-from ) id 1ZSY9O-0003uT-00; Thu, 20 Aug 2015 15:17:34 -0700 From: Mark Brown To: Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse Cc: patches@opensource.wolfsonmicro.com, linux-pm@vger.kernel.org, Mark Brown Date: Thu, 20 Aug 2015 15:12:43 -0700 Message-Id: <1440108763-14776-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.5.0 X-SA-Exim-Connect-IP: 69.84.245.29 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Subject: [PATCH] power: wm831x_power: Convert to devm_kzalloc() X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Mark Brown --- drivers/power/wm831x_power.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c index db11ae6..c826c83 100644 --- a/drivers/power/wm831x_power.c +++ b/drivers/power/wm831x_power.c @@ -499,7 +499,8 @@ static int wm831x_power_probe(struct platform_device *pdev) struct wm831x_power *power; int ret, irq, i; - power = kzalloc(sizeof(struct wm831x_power), GFP_KERNEL); + power = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_power), + GFP_KERNEL); if (power == NULL) return -ENOMEM; @@ -536,7 +537,7 @@ static int wm831x_power_probe(struct platform_device *pdev) NULL); if (IS_ERR(power->wall)) { ret = PTR_ERR(power->wall); - goto err_kmalloc; + goto err; } power->usb_desc.name = power->usb_name, @@ -626,8 +627,7 @@ err_usb: power_supply_unregister(power->usb); err_wall: power_supply_unregister(power->wall); -err_kmalloc: - kfree(power); +err: return ret; } @@ -654,7 +654,6 @@ static int wm831x_power_remove(struct platform_device *pdev) power_supply_unregister(wm831x_power->battery); power_supply_unregister(wm831x_power->wall); power_supply_unregister(wm831x_power->usb); - kfree(wm831x_power); return 0; }