From patchwork Wed Mar 10 12:20:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Mahadev Lad X-Patchwork-Id: 397991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1254AC433E9 for ; Wed, 10 Mar 2021 12:21:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C160C64FF4 for ; Wed, 10 Mar 2021 12:21:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232991AbhCJMV1 (ORCPT ); Wed, 10 Mar 2021 07:21:27 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:51390 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232926AbhCJMU5 (ORCPT ); Wed, 10 Mar 2021 07:20:57 -0500 X-IronPort-AV: E=Sophos;i="5.81,237,1610377200"; d="scan'208";a="74701243" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 10 Mar 2021 21:20:56 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id C1F4E40108E4; Wed, 10 Mar 2021 21:20:53 +0900 (JST) From: Lad Prabhakar To: Dave Stevenson , Mauro Carvalho Chehab Cc: Pavel Machek , Andrey Konovalov , Sakari Ailus , Laurent Pinchart , Jacopo Mondi , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Lad Prabhakar , Biju Das Subject: [PATCH 3/3] media: i2c: imx219: Balance runtime PM use-count in resume callback Date: Wed, 10 Mar 2021 12:20:14 +0000 Message-Id: <20210310122014.28353-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210310122014.28353-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20210310122014.28353-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The runtime PM use-count gets incremented in imx219_set_stream() call when streaming is started this needs to be balanced by calling pm_runtime_put() upon failure to start stream in resume callback. Fixes: 1283b3b8f82b9 ("media: i2c: Add driver for Sony IMX219 sensor") Reported-by: Pavel Machek Signed-off-by: Lad Prabhakar --- drivers/media/i2c/imx219.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 87c021de1460..afffc85cd265 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1184,6 +1184,7 @@ static int __maybe_unused imx219_resume(struct device *dev) { struct v4l2_subdev *sd = dev_get_drvdata(dev); struct imx219 *imx219 = to_imx219(sd); + struct i2c_client *client; int ret; mutex_lock(&imx219->mutex); @@ -1197,7 +1198,9 @@ static int __maybe_unused imx219_resume(struct device *dev) return 0; error: + client = v4l2_get_subdevdata(&imx219->sd); imx219_stop_streaming(imx219); + pm_runtime_put(&client->dev); imx219->streaming = false; __v4l2_ctrl_grab(imx219->vflip, false); __v4l2_ctrl_grab(imx219->hflip, false);