Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1779574ybg; Thu, 4 Jun 2020 19:56:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3WcGJoLdGHXEj30rEWeO1Fu1zK8r189PxPFq64AtjDuGcxWW8VXMXQtOVvpOC47AnpWJu X-Received: by 2002:a50:9e49:: with SMTP id z67mr7341926ede.236.1591325782856; Thu, 04 Jun 2020 19:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591325782; cv=none; d=google.com; s=arc-20160816; b=kFHafi1SnCE73DThm0nb3noM5pnepNks5EIG9KIuHA4MxFmhITKVDRSc2N1spNGd5r CbJzkpcrLFNUbAy0RVTuGvYnuJf1ilx57dP2oI34W3owB9OPcb9MMNQMHRHz/XANZeEC MIrtiv7liY7hhQbV6DEU5Dag8Hp+13ZCLoRjjWp32CMYLfpasUB/kAWzA08Sxo3l+vfF xnN5iPYdOI/ewLKTITAqzo49AZdYmnEnUQ+YQ98NYWfg6c5FsqNRL3aJ8cYexsDnlauy Y10oDE5WF3b4zfSn9NBaqWJmSBl7dJ3z+2aCE0IoYDvWBBWzno3l5feMvB80rm2oWkJA 1U6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=a9/BhDYNHe+rJFbOUG8VhW/tYR8LSfIiYbqfLja5GMo=; b=jeOHWKR847URyCDf8NSgqYdbXH33KdjCHTGZC3yBacTg25ylzhlbjGndsYY47m/a4W dVdt4T67/+8dfdZ4ZzX1WjDxy0ciuo+0KlRsvfB+6VD6q1cfP4Ll0Nsu8194fYhdT0Q7 SjY4GprwNgnHg1z9wK3YwEOVfNiLU5nkBPJcDYs4x4Wvv6RBp/aN1Y8lkWfZoFFfEEmW nNlPOi5qe7aatPHLuNle6Q7i4A6zOUSCbHQIrF11qGupgI7NnNAJ4oYwgvEqj1Iv+2Bw E+2fNQ0OPHj7QTVC4jLdTmRL28W80BCdcZejYSZgFr3EYtuMsP32Boy7KhvuCFcpwcG3 Eh8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OtREKoQi; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ly20si2682475ejb.474.2020.06.04.19.56.00; Thu, 04 Jun 2020 19:56:22 -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=@gmail.com header.s=20161025 header.b=OtREKoQi; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726039AbgFECwQ (ORCPT + 99 others); Thu, 4 Jun 2020 22:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725883AbgFECwP (ORCPT ); Thu, 4 Jun 2020 22:52:15 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 473C9C08C5C0; Thu, 4 Jun 2020 19:52:14 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id c8so8697059iob.6; Thu, 04 Jun 2020 19:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=a9/BhDYNHe+rJFbOUG8VhW/tYR8LSfIiYbqfLja5GMo=; b=OtREKoQiRzE3FsJBBPwfIZQwQnIDLTp1UToGEPSYpO/94D+3/LsNX6r8RsrlvZf7pc EWP3mmFpAei4+SD/MfkcNXL+1xV1VZkSHvXH0EGq+Gip2v00QI+NniTYNLkzgAwN3PG8 L0fYd8SLnOmaNU/+5naOGaNb+KoogzkOuvnCidLze61OiBxyi/kv9sD6CY5pflzzg0UI x1guuQY1wIy0PEG46dkcOnw2QihWXCa1lXS9QH2AsTXzdGZHB1I56b8d1kvQZPJCjjl9 gcX/KuWmgaY8klqICXx2lAmwdBQNlayH0R2+FOpuNu0IATNfmkspwGKBn/7Dw2OO38Vf uwYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=a9/BhDYNHe+rJFbOUG8VhW/tYR8LSfIiYbqfLja5GMo=; b=QNAmYpIWZPssCISnsaN0xRKYCE/M+yhq/uVgCx3m7pCe+1l5al3bWwtojT5BLV0hB0 PZLvbmXZ1HH0VGBhn41OpCGkWMimPPijBsSPgacAezF2Dij6YD/NDxzVqxbORfJva6IO 2nLMU8Ui0AGngvV/dDE8iXy0DJVxobFVhUWIYvlO/QXts9QJGYXIAVeHa6oPwJQx8y5i W1kRJSWkUNCACAbHXfnBGmLyKWhQzOcWghvBxzmwlYVh45xA/bMtR5fJBMpY4p02XQIf MNqP5Ib5BNkuUAMjWx6d9ZQcO+mOTWgLJ/PrMavRWcCVbqqooFSWyjnECfVo2bRXlHdq F4nA== X-Gm-Message-State: AOAM533fEFogIqQYb6t+pcRQALW7Qi3c4H8HFwmli482JcsnAIXrjOgL RwK7Q7uO/62tZ72JhVn75XM= X-Received: by 2002:a02:b704:: with SMTP id g4mr3855393jam.138.1591325533547; Thu, 04 Jun 2020 19:52:13 -0700 (PDT) Received: from cs-u-kase.dtc.umn.edu (cs-u-kase.cs.umn.edu. [160.94.64.2]) by smtp.googlemail.com with ESMTPSA id p11sm738898ioo.26.2020.06.04.19.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 19:52:13 -0700 (PDT) From: Navid Emamdoost To: Linus Walleij , Bartosz Golaszewski , patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: emamd001@umn.edu, wu000273@umn.edu, kjlu@umn.edu, smccaman@umn.edu, Navid Emamdoost Subject: [PATCH] gpio: arizona: handle pm_runtime_get_sync failure case Date: Thu, 4 Jun 2020 21:52:07 -0500 Message-Id: <20200605025207.65719-1-navid.emamdoost@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 5640efe5e750..7520a13b4c7c 100644 --- a/drivers/gpio/gpio-arizona.c +++ b/drivers/gpio/gpio-arizona.c @@ -106,6 +106,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.17.1