From patchwork Fri Apr 27 06:55:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhao X-Patchwork-Id: 8238 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 8C20B24005 for ; Fri, 27 Apr 2012 06:56:37 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 552E4A186EC for ; Fri, 27 Apr 2012 06:56:37 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so857924iag.11 for ; Thu, 26 Apr 2012 23:56:37 -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 :x-spamscore:x-bigfish:x-forefront-antispam-report:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:x-originatororg:x-gm-message-state; bh=z6y5CvPIDTCzutxR6PkU4L3xQZbel8Hx773XFbFzLxE=; b=nzQZQDgQlcFjzzi4kugbkxxwUZftbgqndjNUvXmoJKIUDNuZAg7VdpJsd/yq2AzEml 3mvXENeu2zcv8oyiVWzQj271lXbzJCn6AuBBmId/fa3CE+sfoXscIQf5DDq2nOqTX8md Ai9ziKfAuzOZ4St9ctKCI5LqmPiPWmF5w4SU/gzL0yCfbUhyiS7/NZJiE+QjejFXdTMy 9vQlAb5trQI6JD9sLr266D3/SYZ/ff3CHJUSmN5XasfN7EMkBLXgkiMOE4AaImjNSn8e GVN+ZmnhgmceG+IKD00IrAAeRowm+iFbgHoKi97iwFPRQm9jHfNmcPN6QBE8SX8eZdkk 0WgQ== Received: by 10.50.194.163 with SMTP id hx3mr820886igc.49.1335509797077; Thu, 26 Apr 2012 23:56:37 -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.137.198 with SMTP id x6csp5108ibt; Thu, 26 Apr 2012 23:56:34 -0700 (PDT) Received: by 10.180.75.241 with SMTP id f17mr2980149wiw.11.1335509794059; Thu, 26 Apr 2012 23:56:34 -0700 (PDT) Received: from db3outboundpool.messaging.microsoft.com (db3ehsobe004.messaging.microsoft.com. [213.199.154.142]) by mx.google.com with ESMTPS id x20si6727534wex.94.2012.04.26.23.56.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Apr 2012 23:56:34 -0700 (PDT) Received-SPF: neutral (google.com: 213.199.154.142 is neither permitted nor denied by best guess record for domain of B20223@freescale.com) client-ip=213.199.154.142; Authentication-Results: mx.google.com; spf=neutral (google.com: 213.199.154.142 is neither permitted nor denied by best guess record for domain of B20223@freescale.com) smtp.mail=B20223@freescale.com Received: from mail55-db3-R.bigfish.com (10.3.81.231) by DB3EHSOBE004.bigfish.com (10.3.84.24) with Microsoft SMTP Server id 14.1.225.23; Fri, 27 Apr 2012 06:56:31 +0000 Received: from mail55-db3 (localhost [127.0.0.1]) by mail55-db3-R.bigfish.com (Postfix) with ESMTP id 0B5B64013F; Fri, 27 Apr 2012 06:56:31 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bh84d07hz2dh2a8h668h839hd24he5bh) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail55-db3 (localhost.localdomain [127.0.0.1]) by mail55-db3 (MessageSwitch) id 1335509789346532_29138; Fri, 27 Apr 2012 06:56:29 +0000 (UTC) Received: from DB3EHSMHS015.bigfish.com (unknown [10.3.81.235]) by mail55-db3.bigfish.com (Postfix) with ESMTP id 4721A4E0057; Fri, 27 Apr 2012 06:56:29 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS015.bigfish.com (10.3.87.115) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 27 Apr 2012 06:56:27 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.355.3; Fri, 27 Apr 2012 01:56:26 -0500 Received: from b20223-02.ap.freescale.net (b20223-02.ap.freescale.net [10.192.242.124]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id q3R6uBpk008244; Fri, 27 Apr 2012 01:56:23 -0500 (CDT) From: Richard Zhao To: , , CC: , , , , , , , Richard Zhao Subject: [PATCH 02/11] ASoC: imx-sgtl5000: add of_node_put when probe fail. Date: Fri, 27 Apr 2012 14:55:53 +0800 Message-ID: <1335509762-7777-3-git-send-email-richard.zhao@freescale.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1335509762-7777-1-git-send-email-richard.zhao@freescale.com> References: <1335509762-7777-1-git-send-email-richard.zhao@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Gm-Message-State: ALoCoQlJ2wee78K2sTYerjeTbae5VmBP/pm/SdBXfkruJkEWqjWRL2pqw7CUDa2L57J+6gUeMCFL Signed-off-by: Richard Zhao --- sound/soc/fsl/imx-sgtl5000.c | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-) diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index e1a7441..73b935e 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c @@ -103,24 +103,28 @@ static int __devinit imx_sgtl5000_probe(struct platform_device *pdev) codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); if (!ssi_np || !codec_np) { dev_err(&pdev->dev, "phandle missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto fail; } ssi_pdev = of_find_device_by_node(ssi_np); if (!ssi_pdev) { dev_err(&pdev->dev, "failed to find SSI platform device\n"); - return -EINVAL; + ret = -EINVAL; + goto fail; } data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; + if (!data) { + ret = -ENOMEM; + goto fail; + } ret = of_property_read_u32(codec_np, "clock-frequency", &data->clk_frequency); if (ret) { dev_err(&pdev->dev, "clock-frequency missing or invalid\n"); - return ret; + goto fail; } data->dai.name = "HiFi"; @@ -136,10 +140,10 @@ static int __devinit imx_sgtl5000_probe(struct platform_device *pdev) data->card.dev = &pdev->dev; ret = snd_soc_of_parse_card_name(&data->card, "model"); if (ret) - return ret; + goto fail; ret = snd_soc_of_parse_audio_routing(&data->card, "audio-routing"); if (ret) - return ret; + goto fail; data->card.num_links = 1; data->card.dai_link = &data->dai; data->card.dapm_widgets = imx_sgtl5000_dapm_widgets; @@ -148,14 +152,17 @@ static int __devinit imx_sgtl5000_probe(struct platform_device *pdev) ret = snd_soc_register_card(&data->card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); - return ret; + goto fail; } platform_set_drvdata(pdev, data); - of_node_put(ssi_np); - of_node_put(codec_np); +fail: + if (ssi_np) + of_node_put(ssi_np); + if (codec_np) + of_node_put(codec_np); - return 0; + return ret; } static int __devexit imx_sgtl5000_remove(struct platform_device *pdev)