Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4890857pjb; Mon, 27 Jul 2020 07:43:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx493W61v/JEWGQsPmiWIBFZlohPMhPs/g98bgovW8yXuj19kCT3waUPCSP7pLmfE53mAI7 X-Received: by 2002:a50:fb06:: with SMTP id d6mr21010945edq.165.1595860984457; Mon, 27 Jul 2020 07:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860984; cv=none; d=google.com; s=arc-20160816; b=qUOO9d8/lCnKURgycco12ZES32fOKsulYNdHTpLUTolZabYsa0Sdwnjdg5zuEq/8it csUJztXmWdZyYTKmlZdkEEOfezADLJmOkfp/p84kAvB+BBvxQRAywe17mUh2nwus3hoR VNFJOMNkj72AvcdTmrIod80zpMoftGXoil0FMVU6goXD8hFLbUjOAv+J75jZWClTf8rD LimkI3GlGCC45aXfmhWzy9nbRSyYrBqRhpV9IcAdFXAE9L0t4zswBFlL051Hkz6KSd8K 1V++IjweX2IH6xu+t7fZe267XO8Nc75QJx6/THHHhzOmeVf5gB3U2GfS7qOunuu/PHMp fy1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2IczPDtMoFfL+gQ6lwI9TBAPHotqLQhFJKo3DtJhR+E=; b=fqKm2wFz3hHDGGuf/pqsQgStO4rFA1co0c2oLFynHEVNjsxDJiSrjusrnChtzakHOX oaJkZDJDBbwFpOnsfmdI+0eEcagBRMxOxEFTechEHJSEjblBo3W7jQ2YI6+lk7UABGNF h3AQZc/vgw0uDouMkBSq9LBC3EKSeUxXqgvmZIPbKgjAjtnC40nksh1MPgu3HUw3bwND NEAZBMze6nbSt2UaFUAQVXv4x3csYA7VbAkEoq2zZ8irMM4IXfQtK/inrLqYJEHb8r+j 2e5FR/UMHBiefK5MrYW9sEIQo+DvGlfjXZRcTrFQxoxtLUubCF4DBdL3Z2N893TBYVje TIyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fUAuOeIF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 30si914165edr.109.2020.07.27.07.42.42; Mon, 27 Jul 2020 07:43:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fUAuOeIF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729666AbgG0OJn (ORCPT + 99 others); Mon, 27 Jul 2020 10:09:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:59928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729675AbgG0OJj (ORCPT ); Mon, 27 Jul 2020 10:09:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95E4C2250E; Mon, 27 Jul 2020 14:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595858979; bh=l8HeCmPkk//bGW1au8adPFQS7xsRUtU3zITNzOeRkHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fUAuOeIFNpb1zVJATryrACZn9E5EOruQOd3CttSgtz5mt1Ky28JVvAHZWgEo0rpzR XWsxYENcKNY+rIJLOKvUfKxHZNYorzZEao5vEG4Jsxc90Q3dIqw6cMFIZFH58Qfxka fkMBtSamRGUXzUqNKxcvtzpGQry2keFRSZy6+CcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Charles Keepax , Linus Walleij , Sasha Levin Subject: [PATCH 4.19 02/86] gpio: arizona: handle pm_runtime_get_sync failure case Date: Mon, 27 Jul 2020 16:03:36 +0200 Message-Id: <20200727134914.441587217@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134914.312934924@linuxfoundation.org> References: <20200727134914.312934924@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Navid Emamdoost [ Upstream commit e6f390a834b56583e6fc0949822644ce92fbb107 ] Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count. Call pm_runtime_put if pm_runtime_get_sync fails. Signed-off-by: Navid Emamdoost Acked-by: Charles Keepax Link: https://lore.kernel.org/r/20200605025207.65719-1-navid.emamdoost@gmail.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/gpio/gpio-arizona.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c index ba51ea15f3794..485aa45fc5d53 100644 --- a/drivers/gpio/gpio-arizona.c +++ b/drivers/gpio/gpio-arizona.c @@ -111,6 +111,7 @@ static int arizona_gpio_direction_out(struct gpio_chip *chip, ret = pm_runtime_get_sync(chip->parent); if (ret < 0) { dev_err(chip->parent, "Failed to resume: %d\n", ret); + pm_runtime_put(chip->parent); return ret; } } -- 2.25.1