From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755238AbbBTQKu (ORCPT ); Fri, 20 Feb 2015 11:10:50 -0500 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:52908 "EHLO opensource.wolfsonmicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750770AbbBTQKr (ORCPT ); Fri, 20 Feb 2015 11:10:47 -0500 From: Charles Keepax To: broonie@kernel.org Cc: lgirdwood@gmail.com, linux-kernel@vger.kernel.org, patches@opensource.wolfsonmicro.com Subject: [PATCH 2/2] regulator: arizona-micsupp: Drop OF node reference on error path Date: Fri, 20 Feb 2015 16:08:44 +0000 Message-Id: <1424448524-31110-2-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1424448524-31110-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> References: <1424448524-31110-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We were not calling of_node_put if the regulator failed to register this patch fixes this. Signed-off-by: Charles Keepax --- drivers/regulator/arizona-micsupp.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index 2007900..4116e74 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c @@ -284,6 +284,9 @@ static int arizona_micsupp_probe(struct platform_device *pdev) micsupp->regulator = devm_regulator_register(&pdev->dev, desc, &config); + + of_node_put(config.of_node); + if (IS_ERR(micsupp->regulator)) { ret = PTR_ERR(micsupp->regulator); dev_err(arizona->dev, "Failed to register mic supply: %d\n", @@ -291,8 +294,6 @@ static int arizona_micsupp_probe(struct platform_device *pdev) return ret; } - of_node_put(config.of_node); - platform_set_drvdata(pdev, micsupp); return 0; -- 1.7.2.5