From patchwork Thu May 23 15:25:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 17146 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f200.google.com (mail-gh0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 55A502395B for ; Thu, 23 May 2013 15:26:45 +0000 (UTC) Received: by mail-gh0-f200.google.com with SMTP id 10sf3828651ghy.3 for ; Thu, 23 May 2013 08:25:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=f4Di4ntWfOJ7N0WImgBpYFFJxCNHASM150bLWc4lzwc=; b=not2bmgMBrUwFlRi/O2Nk8CTRj/+iZn3qgtklJYudarokP+yfMFItUgFdfEEMHKooU uDPv0kgUeNQH5Fhx5thlKIQ2/xAoZ7xGt/h68gUH0CZcwhtzlRRhTJtMSaZp74uCoZxl nMPAGQsMlS0ut6vhM3QwyRaB/6ujngVEy7YQP/wUO9ADQAb1n3xwLIDIpSkvXxYl1sob 4n5EQ8eopc2QJbPyFGY5QkBevwmMmQGhI2KtRFg1Oi5z5Gy1T6YM8Cu1z59b2XujkghV +Cf3GvgUXtZkB74SUReN+6IEr5t0UWWxHSFg5z8xsk/q3ULMrFEqu2DTYvjQ2vvHGF2i MCIw== X-Received: by 10.236.163.193 with SMTP id a41mr6545697yhl.0.1369322749874; Thu, 23 May 2013 08:25:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.108.134 with SMTP id hk6ls1460891qeb.72.gmail; Thu, 23 May 2013 08:25:49 -0700 (PDT) X-Received: by 10.52.0.130 with SMTP id 2mr4725186vde.97.1369322749644; Thu, 23 May 2013 08:25:49 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id iz8si6632331vdb.84.2013.05.23.08.25.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id ib11so2279689vcb.22 for ; Thu, 23 May 2013 08:25:49 -0700 (PDT) X-Received: by 10.220.238.4 with SMTP id kq4mr5644996vcb.73.1369322749501; Thu, 23 May 2013 08:25:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp57020vcs; Thu, 23 May 2013 08:25:49 -0700 (PDT) X-Received: by 10.180.72.227 with SMTP id g3mr6571818wiv.1.1369322748613; Thu, 23 May 2013 08:25:48 -0700 (PDT) Received: from mail-wi0-x230.google.com (mail-wi0-x230.google.com [2a00:1450:400c:c05::230]) by mx.google.com with ESMTPS id ej4si9241845wic.27.2013.05.23.08.25.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:48 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::230 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c05::230; Received: by mail-wi0-f176.google.com with SMTP id hr14so4647805wib.3 for ; Thu, 23 May 2013 08:25:48 -0700 (PDT) X-Received: by 10.180.198.175 with SMTP id jd15mr5627148wic.28.1369322748237; Thu, 23 May 2013 08:25:48 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPSA id d10sm36397561wik.0.2013.05.23.08.25.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:47 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: Lee Jones Subject: [PATCH 12/16] mfd: htc-i2cpld: Convert to managed resources for allocating memory Date: Thu, 23 May 2013 16:25:13 +0100 Message-Id: <1369322717-30429-12-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1369322717-30429-1-git-send-email-lee.jones@linaro.org> References: <1369322717-30429-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnalYne7bF3BaCdt4LJlMXJOzltqNZ2gssQImiFzeAOjznLNRTEqAjMQSEbIXKid1ZfgfDI X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Lee Jones --- drivers/mfd/htc-i2cpld.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c index 324187c..c9dfce6 100644 --- a/drivers/mfd/htc-i2cpld.c +++ b/drivers/mfd/htc-i2cpld.c @@ -514,8 +514,8 @@ static int htcpld_setup_chips(struct platform_device *pdev) /* Setup each chip's output GPIOs */ htcpld->nchips = pdata->num_chip; - htcpld->chip = kzalloc(sizeof(struct htcpld_chip) * htcpld->nchips, - GFP_KERNEL); + htcpld->chip = devm_kzalloc(dev, sizeof(struct htcpld_chip) * htcpld->nchips, + GFP_KERNEL); if (!htcpld->chip) { dev_warn(dev, "Unable to allocate memory for chips\n"); return -ENOMEM; @@ -580,12 +580,11 @@ static int htcpld_core_probe(struct platform_device *pdev) return -ENXIO; } - htcpld = kzalloc(sizeof(struct htcpld_data), GFP_KERNEL); + htcpld = devm_kzalloc(dev, sizeof(struct htcpld_data), GFP_KERNEL); if (!htcpld) return -ENOMEM; /* Find chained irq */ - ret = -EINVAL; res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (res) { int flags; @@ -598,7 +597,7 @@ static int htcpld_core_probe(struct platform_device *pdev) flags, pdev->name, htcpld); if (ret) { dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret); - goto fail; + return ret; } else device_init_wakeup(dev, 0); } @@ -609,7 +608,7 @@ static int htcpld_core_probe(struct platform_device *pdev) /* Setup the htcpld chips */ ret = htcpld_setup_chips(pdev); if (ret) - goto fail; + return ret; /* Request the GPIO(s) for the int reset and set them up */ if (pdata->int_reset_gpio_hi) { @@ -644,10 +643,6 @@ static int htcpld_core_probe(struct platform_device *pdev) dev_info(dev, "Initialized successfully\n"); return 0; - -fail: - kfree(htcpld); - return ret; } /* The I2C Driver -- used internally */