Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3884063pxv; Mon, 19 Jul 2021 11:04:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnH6OVGToYJssIsvpAvPbKrxwBTBf+fBdvMrLsZJWB3hFacLcFEncv7mzVYpJqfHeSj8AJ X-Received: by 2002:aa7:cb18:: with SMTP id s24mr35912136edt.99.1626717865508; Mon, 19 Jul 2021 11:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626717865; cv=none; d=google.com; s=arc-20160816; b=k4W8Aj0GTqWLZ6OtzW75NqbGQ3XBHDpnWW+sxpZISyCdY4tD1zymQrEIEf3EgFhksX XyRoKc6gH/ntrXbXLlYW2FC/9BhgPYSbop1XC72eshUZufNzH9jfH8Y9x6HzWJf+daNG uarAbH2EBGuVGO3OyC/qkWJvxyfj3tCE1c3MuL8tgqBQhq05RfXDUBWHQkJ3hxbY4gTj I50sku2VzyPds9+vxC8HCtuFL0qOSkiYYLE+BYC0M/0IXgms/rvmNzOpOvllt5P+el4d gkEvdWlz/X1Gd9fzsYW4pwoc8m9V5bG0bc77/AsSqipCY755YRBlQzPO/WUxRTWGCIw3 8+Vw== 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=IDUpsJrdzaaBbBL3lR2GLz41LQz47KJzN85j3yMeZghggDeokhifeoVvqKp6guPubD zD1XwQFegWenXHlbdU5/BeZ7Z1QIfy+fhxzOSMMquYAHwhNNf6rF4V6dsAY/4pR2AYqE bDh0nugiXgK+QMGovqfaN9FRuJxE99QNwD3AUFECHAXhnw8gCN1LLxTVVRAzH5+R4n2+ XQbgRJXaLXJI5pUl+3rHQKiVJjSV+SWdr8natUT98OvuB/BOB/4O2hWuJrHbtQf6H3Wc qplSOC8Kpbp+Qi5+krhzLftsHRGtRO5IYie/q+wNLOOi/UWufxqKMQD7Fkgi+u8mn5Wz JfMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lhk6DndT; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si27598928ejy.271.2021.07.19.11.04.01; Mon, 19 Jul 2021 11:04:25 -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=@linuxfoundation.org header.s=korg header.b=lhk6DndT; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235423AbhGSRRs (ORCPT + 99 others); Mon, 19 Jul 2021 13:17:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:34260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233689AbhGSPkm (ORCPT ); Mon, 19 Jul 2021 11:40:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F03161363; Mon, 19 Jul 2021 16:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626711652; bh=cyHD2oQuOJvUpiuoQ4Y/gRXIIVB8xWrQuC8BwU950Ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhk6DndT0uRfe1vWTJmxdmcrFF2qJsY5131IUakDt34T8uOImU863s74dM1GSM/n9 +9nGThQJaeR84Li541rSbY1QIBJYMu0oINWH5wugQ5eOK8h/fkNxMVFa4+tBKOYaze WnCnAfPJ1DpN1Dx2qfvqATi4fle137M6X22rt2MA= 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.12 048/292] iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get(). Date: Mon, 19 Jul 2021 16:51:50 +0200 Message-Id: <20210719144944.090229374@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.514164272@linuxfoundation.org> References: <20210719144942.514164272@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 @@ 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); -- 2.30.2