From patchwork Wed Jan 30 19:40:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 14372 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 4B5A423EAD for ; Wed, 30 Jan 2013 19:40:39 +0000 (UTC) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by fiordland.canonical.com (Postfix) with ESMTP id 19138A19428 for ; Wed, 30 Jan 2013 19:40:38 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id m18so1238676vcm.22 for ; Wed, 30 Jan 2013 11:40:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :mime-version:content-type:x-gm-message-state; bh=liSsiIP3WVpovdKeNayPVOH8ZnQrylQGnOFyaqB8HcU=; b=k8oV1DRYo3yJG86HIaTkzxoYu4M5MKx+O+cC6E1i+Ow3s5Du51zjWvnuLGaG4GRjoO Dp1vu6EMPYkiB2mEM3PydiJnapZDweXvoxrLSG/fb9DgiCe2KTy0RiQ8kxoCLGy1Vbtv x59FLW/aYYH7Zvso7n4e7EtTtcQuzFtyQ8asXaHcZi8yCSDEHqrCSMgLrSBU7A/8j3Vi QesE5Oe+/HXQQ4HShjLb0TCvlMRp93u2k7wJ374iXSey8Ny3ZXb9lGullpMQrmzaKt3T 84tAYMQyaOqysKjRdmzNRyQgrfUFVYZ4MFGpgV7LvHKb2lISiD/S8f3GCr6kNlmPA13U Ppiw== X-Received: by 10.58.232.226 with SMTP id tr2mr1567195vec.48.1359574838577; Wed, 30 Jan 2013 11:40:38 -0800 (PST) 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.58.252.8 with SMTP id zo8csp26293vec; Wed, 30 Jan 2013 11:40:38 -0800 (PST) X-Received: by 10.14.218.71 with SMTP id j47mr18069692eep.28.1359574837609; Wed, 30 Jan 2013 11:40:37 -0800 (PST) Received: from eu1sys200aog103.obsmtp.com (eu1sys200aog103.obsmtp.com [207.126.144.115]) by mx.google.com with SMTP id 7si405518eec.242.2013.01.30.11.40.29 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 30 Jan 2013 11:40:37 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.115 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.115; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.115 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob103.postini.com ([207.126.147.11]) with SMTP ID DSNKUQl3LM5pW8kBlId+so8xU4/hr53oRxyH@postini.com; Wed, 30 Jan 2013 19:40:37 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id D490ED9; Wed, 30 Jan 2013 19:32:16 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id B136E8B1; Wed, 30 Jan 2013 19:40:25 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 9350AA807E; Wed, 30 Jan 2013 20:40:17 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 30 Jan 2013 20:40:24 +0100 From: Linus Walleij To: , Cc: Stephen Warren , Anmar Oueja , Lee Jones , Linus Walleij Subject: [PATCH 4/4] pinctrl/abx500: destroy mutex if returning early due to error Date: Wed, 30 Jan 2013 20:40:22 +0100 Message-ID: <1359574822-15729-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQknK5DILupckf2Oy0CL7rid04G3eBOv4lPDI4oZkgwQ3MzODuR7A7FcIWw7UNpUIgidX5Tr From: Lee Jones Current failure path neglects to mutex_destroy() before returning an error due to an invalid parameter or an error received from gpiochip_add(). This patch aims to remedy that behaviour. Signed-off-by: Lee Jones Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-abx500.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 426b47c..81ef515 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c @@ -1155,11 +1155,13 @@ static int abx500_gpio_probe(struct platform_device *pdev) default: dev_err(&pdev->dev, "Unsupported pinctrl sub driver (%d)\n", (int) platid->driver_data); + mutex_destroy(&pct->lock); return -EINVAL; } if (!pct->soc) { dev_err(&pdev->dev, "Invalid SOC data\n"); + mutex_destroy(&pct->lock); return -EINVAL; } @@ -1176,6 +1178,7 @@ static int abx500_gpio_probe(struct platform_device *pdev) ret = gpiochip_add(&pct->chip); if (ret) { dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret); + mutex_destroy(&pct->lock); goto out_rem_irq; } dev_info(&pdev->dev, "added gpiochip\n");