From patchwork Wed Apr 3 08:45:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 15836 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 6C74723E21 for ; Wed, 3 Apr 2013 08:46:48 +0000 (UTC) Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by fiordland.canonical.com (Postfix) with ESMTP id 08B77A18484 for ; Wed, 3 Apr 2013 08:46:47 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id z12sf1906763yhz.8 for ; Wed, 03 Apr 2013 01:46:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received: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=cppqagVfTL/oOVdc/naD4FMB0rzqmj2Ko4KkAQRbnYM=; b=StCHeKCgroqUE7TVcv7HDWBCuAwuA1mMuAExJWaaEkLjt/R3ZcyMzT/0BK7r0dGcMX jSaKj0HI8cnx+JDhh7NoVcvQQjyoTfctut2ZEUuow7Y+gxdQlSK3ZEKg+enZqbhwHLFw tGQZA89ODqVhJQiC4x/jxPPYcDe5R1OPT+kaeD50Ni8ZhG2VfieFZ0lRS4uUgwLngdDs k6ASaj7i9oenUWZZiTzRn6K16983KOz1iM2wan688uUz3jFuBW2XHV7VpFod8Qns+zyg /nm/w5MjU10R9DOAymgegvPLMVTGXP189Jc5+f5N/2518rnZWXtGzr/dbUGYM3IBy8NF /YEw== X-Received: by 10.224.172.200 with SMTP id m8mr706810qaz.0.1364978807571; Wed, 03 Apr 2013 01:46:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.241 with SMTP id l17ls789669qej.99.gmail; Wed, 03 Apr 2013 01:46:47 -0700 (PDT) X-Received: by 10.52.92.225 with SMTP id cp1mr444039vdb.41.1364978807346; Wed, 03 Apr 2013 01:46:47 -0700 (PDT) Received: from mail-vb0-x22f.google.com (mail-vb0-x22f.google.com [2607:f8b0:400c:c02::22f]) by mx.google.com with ESMTPS id sx2si4278340vdc.19.2013.04.03.01.46.47 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:46:47 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22f is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22f; Received: by mail-vb0-f47.google.com with SMTP id x13so258131vbb.6 for ; Wed, 03 Apr 2013 01:46:47 -0700 (PDT) X-Received: by 10.220.106.14 with SMTP id v14mr546475vco.2.1364978807208; Wed, 03 Apr 2013 01:46:47 -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.59.4.204 with SMTP id cg12csp160607ved; Wed, 3 Apr 2013 01:46:46 -0700 (PDT) X-Received: by 10.15.32.67 with SMTP id z43mr1841308eeu.24.1364978805993; Wed, 03 Apr 2013 01:46:45 -0700 (PDT) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by mx.google.com with ESMTPS id t8si7624702eeg.4.2013.04.03.01.46.38 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:46:45 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.49 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=74.125.83.49; Received: by mail-ee0-f49.google.com with SMTP id d41so561058eek.8 for ; Wed, 03 Apr 2013 01:46:38 -0700 (PDT) X-Received: by 10.15.22.197 with SMTP id f45mr1693143eeu.46.1364978798577; Wed, 03 Apr 2013 01:46:38 -0700 (PDT) Received: from localhost ([2a01:2003:1:1e91:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id f47sm6856074eep.13.2013.04.03.01.46.32 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:46:37 -0700 (PDT) From: Fabio Baltieri To: Felipe Balbi Cc: Linus Walleij , Praveena Nadahally , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Fabio Baltieri Subject: [PATCH 02/12] usb: phy: ab8500-usb: convert to devm_kzalloc Date: Wed, 3 Apr 2013 10:45:03 +0200 Message-Id: <1364978713-19612-3-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1364978713-19612-1-git-send-email-fabio.baltieri@linaro.org> References: <1364978713-19612-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQlQ5gIPGy73+7IaUvQFmMxqXZVdBJKivpHoJJ7lVKrWFRTmsZprqO1F8BEESq2dpvLI+rgB X-Original-Sender: fabio.baltieri@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22f 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: , Convert local data allocation to devm_kzalloc and drop unnecessary fail path code. Acked-by: Linus Walleij Signed-off-by: Fabio Baltieri --- drivers/usb/phy/phy-ab8500-usb.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 351b036..ab6dd07 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -628,15 +628,13 @@ static int ab8500_usb_probe(struct platform_device *pdev) return -ENODEV; } - ab = kzalloc(sizeof *ab, GFP_KERNEL); + ab = devm_kzalloc(&pdev->dev, sizeof(*ab), GFP_KERNEL); if (!ab) return -ENOMEM; - otg = kzalloc(sizeof *otg, GFP_KERNEL); - if (!otg) { - kfree(ab); + otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); + if (!otg) return -ENOMEM; - } ab->dev = &pdev->dev; ab->ab8500 = ab8500; @@ -665,12 +663,12 @@ static int ab8500_usb_probe(struct platform_device *pdev) err = ab8500_usb_irq_setup(pdev, ab); if (err < 0) - goto fail; + return err; err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2); if (err) { dev_err(&pdev->dev, "Can't register transceiver\n"); - goto fail; + return err; } /* Needed to enable ID detection. */ @@ -679,10 +677,6 @@ static int ab8500_usb_probe(struct platform_device *pdev) dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev); return 0; -fail: - kfree(otg); - kfree(ab); - return err; } static int ab8500_usb_remove(struct platform_device *pdev) @@ -700,9 +694,6 @@ static int ab8500_usb_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); - kfree(ab->phy.otg); - kfree(ab); - return 0; }