From patchwork Mon Jul 19 14:51:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 479985 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4258167jao; Mon, 19 Jul 2021 08:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyty8rB275WiodN3E/0w6zhC2r6n2YxMLSzvJJeFW1uluWMDnu64ks7X2VHzrhFt/A90RCu X-Received: by 2002:a05:6402:1218:: with SMTP id c24mr34649952edw.59.1626710298721; Mon, 19 Jul 2021 08:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626710298; cv=none; d=google.com; s=arc-20160816; b=UiV0zLMX1GMcU4RGcEfB7MnS3bZFDJF6n2xGje+hpulR+wYqPdgh4kqBvG9n2qciAr NE29/sky29QwHC8++I1gegC3Xdw0TjH9P0rBdFymlMI+uHWLLLV0m4btMYq1pnIvJ5GT 3MJjrJ43sjcVjuoHXxt5a40iYtJduYyEsW1Z3KVnraJztKDi0TL5zkYbhpEM+qG/v+6O JB3NOTsVUdYrKhaczfUyGzkSeZsD/Gsa4mFL3DuIKsuALQGNvYLve4uuVZAbR9jiK4pn IswMT1ILGedknfs/Q0hL3GGfG5OAmgiBAzxX1UTpO2473X6NNTWlxtOdpNCgPQcLU6LC PZRQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GZ+jIpjNxhgb8IW55+3bgSknVfmOcM2aMKl3Uk54dtA=; b=fW8fCsEjUdw5k7ZeTYmS3fmpS5VoanrPWCPgJP8wa3M1kkVmwA60DDejEUnJPiPowb iRZyiIcTdm2YW2n0gOu3J382IsoJY4PEVAdkEwzm2ErjjBEo+0dOXuZHf8m7OV+DZ8Up TUJqIZqu1HPVx/WbXb3vKfNZbJUlITtDoR597Zb+BnvjD5RmlVjNGGCG4O7U3hgkaH0m fQ+j0UH+YG/fqhK60aXbVLv6GpvOReRFcJlUCvK+s2dIjM8q8pXGfRFodUCCL2wHfuRM a90qBkRdIAAsRWuxhx1BKu6ESuWKtLhCChmBo6Ayp/e1T+PaHqMYlk5FHlFSNlZoidxl QiNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SAlYJlQ4; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la14si22045543ejc.142.2021.07.19.08.58.18; Mon, 19 Jul 2021 08:58:18 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=SAlYJlQ4; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346426AbhGSPRX (ORCPT + 12 others); Mon, 19 Jul 2021 11:17:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:48928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345690AbhGSPNr (ORCPT ); Mon, 19 Jul 2021 11:13:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C7A2861351; Mon, 19 Jul 2021 15:53:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626710021; bh=cyHD2oQuOJvUpiuoQ4Y/gRXIIVB8xWrQuC8BwU950Ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SAlYJlQ4ziqHcFftwrmDDcvL/Q9JzGMuM9zwgR1hK/e4khSB0nc1lO8/LtKiijjKI a4rjAnaoTS1P8WkLkMDEGa75+PtkLntrkUoFBHXy7/novrttgcugvYSgCHDcO6oN4C Bl1+ZMnxcAeKH31e3FDeDP9akD9OKWf8wNeKxyio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Rui Miguel Silva , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 035/243] iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get(). Date: Mon, 19 Jul 2021 16:51:04 +0200 Message-Id: <20210719144942.065467933@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144940.904087935@linuxfoundation.org> References: <20210719144940.904087935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.30.2 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 @@ out_unlock: 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);