From patchwork Mon Jul 19 14:50:02 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: 479997 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4270148jao; Mon, 19 Jul 2021 09:10:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv466z0Z7Poz/reoBgjpSCGYbaJpKEzdsMNrLfJoJX6m4jL6EdSof2q8T50nkYFH4EOA+i X-Received: by 2002:a17:906:c29a:: with SMTP id r26mr28633470ejz.235.1626711042925; Mon, 19 Jul 2021 09:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626711042; cv=none; d=google.com; s=arc-20160816; b=ZWprfpXlfJBDByiRx7WVmDW4U9axi3yD2WC5XWntl/p/0iBwzZdO2RezH955mUcegZ dc/Yqf5siGuRgMC4Vozuu4Z9V1HF8t/I2ZgWQJ+E5IpXfiw4gTug4lTcobUJOerfO4iU ORw/4iOHf7mqZB26F6lZdQN2xK/eXCKGTXgKWx9EwYRBP0JCjVZbqtgphvJP59Y8vIZc +JFW14EvIbwTTijsfJkghyy6uaSZNQik8Iv2afshdLeavpVbNyu/Yi0YktKL1XqNbu/0 w0iwwKmWTffyjISf3AkGqAo64xb5wETckjSLiiq5mqjoJiD+szXghU+NX35T7mLGEeeB 31Sg== 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=iH9yAsrINmG0Vd8Aqk7OhwgNAkoQ2DF/2+U5LzumnqI=; b=X3hkTVRHnRFDRoT6GygtANgqGs4JpDeYPLjVKkz/Y+27qayBbGT0Bu+EzC+GNnFEzl XsqSs5qqmhJ0oSs1Fx52JiXcTy6+59DMch4r+jiy3ODA39vaM6ma9BwgqK1nmbM6rSSI oXLPSt0F4Ut5AHEpPh0TTmTq8KIfi0l8cV9f7KG/Mm7UPddUXtBbTeaqYZJFeihimZNe Gke/CieWqmzK4eYbdqL8aOQErMmlIlWhsSzVHIvI/ix9yDP8CqG8jzEvB+ext0RtSaVE CZfZhR3kGR6kh5JJRzR1LISnXg2DiHw4A43+JYAI/uB9uFFYjI2Wiu1Bs4IuyjuH51L2 nGCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MMqFikjE; 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.09.10.42; Mon, 19 Jul 2021 09:10:42 -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=MMqFikjE; 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 S1346217AbhGSP1m (ORCPT + 12 others); Mon, 19 Jul 2021 11:27:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:40604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348306AbhGSPYm (ORCPT ); Mon, 19 Jul 2021 11:24:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2D6460FD7; Mon, 19 Jul 2021 16:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626710666; bh=GbTw4qsid/e56S6eVYb4+Kd5Y7yuvvNBgKCi04/oJj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MMqFikjE55hxHauu4YQX6ndp9iNuiUM4YFrihzwL3YWHJZhM5yZQJXmBhqa3N8q3a MBJji804pS3FodCbqWgFgquIVdppwCc9Oewc+8ONMi/1SMfwBHD20QeyWytsZ1BRbe lXvJ76kQa8qQMsWM6fKdFPAwFdDV4CwqZ1Tm23hU= 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.13 056/351] iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get(). Date: Mon, 19 Jul 2021 16:50:02 +0200 Message-Id: <20210719144946.385912247@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144944.537151528@linuxfoundation.org> References: <20210719144944.537151528@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 645461c70454..6a85f231fd57 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) @@ -1004,7 +997,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; } @@ -1018,7 +1010,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);