Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1147254pxv; Fri, 9 Jul 2021 19:31:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqpq50rUD7XwplNlP84MKMnLeMeDUecXPiIErun9rveqp+IaeuWUGgSZLCTAPwnridg3GL X-Received: by 2002:a17:906:2bd9:: with SMTP id n25mr41245113ejg.513.1625884265609; Fri, 09 Jul 2021 19:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884265; cv=none; d=google.com; s=arc-20160816; b=G8OtaArT0W7SBmFKPAM9pSLJILU+499pMACPYgjPdjfeHEZp+DrxwV75LqygziuQqn 2Gdeoc/qxedHIqqf3DYileJiFFWGZB5FHIjpAYOH03JmfKj+QGF35vqHs72iHB5KCuLo EHW+hhMt1VF9EZDlhJMuD/ZxR3IBhvUq0E1H/X8neSwC9y+hf+lM2NPZwaNAx+764T1k YXA1jZ7iXFCJ+cIKDlFNqX9LKYnHHYuqusJc38rDvcxV7Itpj9BSOWwdgTv7Niyfioke 5a4Su5FlAGs2BGiWylcNoz5sTjqLkhlktxDQiRJu435LNrKke8j2RDYT3GKASLMO/JI/ /bXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vXmAyyAGnrG9im+/0Tf2oBYMNeD58JTmwKi6je4NTBQ=; b=sHTzcL7OKM4bDwXdjsMY8DQYqcqISiyCVHbk1tfjho2Ebvs/VgrKTRYSeix3oQcTwT UOJPO1NsWgHAfqGZsh4xmTnmBBAmMwhhp/LOp1D4sAi/22XaAfiUeJI60iGZZkOi25sZ 1w/yGChNvt3YXfF6R8fFY3jQ7iPwsrf5rvaYwbNXYUW7e6F7czBTngO+EneQXs0sbQT9 V6Xp71GuJ5M97AATVVEAsXWNDNNhq/G2DlHl0AhfExpHy//r/Cu6Isou/TlTL2ZYuHoB XPyh7v58GJp6n3YnUyF+LjSqP7GCBmkwB3jtXomaU+pwSzxFpiBCYZFpQU7fHcF+VUwx j6bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DtIOtV+L; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si12110566ejl.693.2021.07.09.19.30.42; Fri, 09 Jul 2021 19:31:05 -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=k20201202 header.b=DtIOtV+L; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234157AbhGJCae (ORCPT + 99 others); Fri, 9 Jul 2021 22:30:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:42704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233773AbhGJC16 (ORCPT ); Fri, 9 Jul 2021 22:27:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8BFA761414; Sat, 10 Jul 2021 02:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883888; bh=KRbNFtgLa7uy+upaXNk0ep7zr+WJWjk7VFl4kzY/Jk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DtIOtV+LpGG+ib+Ms0bvXQkAO/d6yu59Dh/yQD2IuHzbDn1in72GH6TRpnBIW8OJT zB3z3lSy8EcKGV6Nbh0x9Fo3h7441jO0Milq5+rxiqZA7OVTH9iRwbcbgcrIOMpp6W AxYDgJWGKSbDEW757DkOu7KWe+/h/2ZrRSgEq7C6xNJPeQc6yHIsEqS6WAr0bw2IGt jJE4QG8RDpRH3PG1ROrHS3drJVWou1D+yAawJOj8IZ4K4Bm0EohEfg9ZrK3ShM7d3n DJ6+5Mxk7RJvJck9WDbekOpW/O3fEFdIERzOvpqk6IQXbvE8vkH4pPuKXkupn/UwNB El2TgK1BWtNVA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jonathan Cameron , Rui Miguel Silva , Mauro Carvalho Chehab , Sasha Levin , linux-iio@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 15/93] iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get(). Date: Fri, 9 Jul 2021 22:23:09 -0400 Message-Id: <20210710022428.3169839-15-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022428.3169839-1-sashal@kernel.org> References: <20210710022428.3169839-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 41120ebbb1eb5e9dec93320e259d5b2c93226073 ] In both the probe() error path and remove() pm_runtime_put_noidle() is called which will decrement the runtime pm reference count. However, there is no matching function to have raised the reference count. Not this isn't a fix as the runtime pm core will stop the reference count going negative anyway. An alternative would have been to raise the count in these paths, but it is not clear why that would be necessary. Whilst we are here replace some boilerplate with pm_runtime_resume_and_get() Found using coccicheck script under review at: https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/ Signed-off-by: Jonathan Cameron Reviewed-by: Rui Miguel Silva Reviewed-by: Mauro Carvalho Chehab Link: https://lore.kernel.org/r/20210509113354.660190-2-jic23@kernel.org Signed-off-by: Sasha Levin --- drivers/iio/gyro/fxas21002c_core.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c index b7523357d8eb..ec6bd15bd2d4 100644 --- a/drivers/iio/gyro/fxas21002c_core.c +++ b/drivers/iio/gyro/fxas21002c_core.c @@ -366,14 +366,7 @@ static int fxas21002c_write(struct fxas21002c_data *data, static int fxas21002c_pm_get(struct fxas21002c_data *data) { - struct device *dev = regmap_get_device(data->regmap); - int ret; - - ret = pm_runtime_get_sync(dev); - if (ret < 0) - pm_runtime_put_noidle(dev); - - return ret; + return pm_runtime_resume_and_get(regmap_get_device(data->regmap)); } static int fxas21002c_pm_put(struct fxas21002c_data *data) @@ -1005,7 +998,6 @@ int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq, pm_disable: pm_runtime_disable(dev); pm_runtime_set_suspended(dev); - pm_runtime_put_noidle(dev); return ret; } @@ -1019,7 +1011,6 @@ void fxas21002c_core_remove(struct device *dev) pm_runtime_disable(dev); pm_runtime_set_suspended(dev); - pm_runtime_put_noidle(dev); } EXPORT_SYMBOL_GPL(fxas21002c_core_remove); -- 2.30.2