Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp199983pxf; Wed, 10 Mar 2021 04:23:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwr+fEPQYwWuAdXcgO/YP4QcaL909be6gPBG8sI+kwlGtQRrws8skFudz6uX2nmySsEuhjv X-Received: by 2002:a17:906:400b:: with SMTP id v11mr3406510ejj.194.1615379023130; Wed, 10 Mar 2021 04:23:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615379023; cv=none; d=google.com; s=arc-20160816; b=Sl0oXGxvSGbGymzdiFvM2bNaC+zk8VFrZBBChzkI/T34LJHpNEbROLOIn1HLPNE6ck 1f0iFzdsPyjHu1jupkWn9+qm9TE8EQ6g0LwuU2wxdUgiORT0HwjeBSyuL/XVczqnkCHa Kw3bOcl0RbkfZ8IZzOdWfsPW/WCVsn3hDvoGd5zc6CCTFteDdCtZ0U0fUD+7hpnP/8Rp 1PDc6QV3HU2a3E6OUwNlfZ8D1/jSsA7jaJFzzy9HTvJlfu9+w0bv7uLL7huASfz56FAN WuXemDZkhkbJTa+hmSkoMAZyT7SVShbsO3CCvTPVsQECqELERCih88jn1OxyZH3U1lu7 HHMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=H9K55kjuJdkSQASl+qijZD0h4shBEO3HzFgMXquwKUM=; b=wqdlnUjdez8aqtXwWIDLrMt8xW1Dhk5cm+DZsO28cp47v9y7SplYwmR5sCsYC+W7Ky mMwlA0GxqSqabx8Ep8ryDkJ/0vbeIjE9IMMUaMJpTUqQQvI/oXvdZ21WR9tYPPhBDb6F OjyIwc3IFnyHQxMoleyayAb/nr/hsKp7l/szFzLBxth2Bk2aT9HOki7E0SKdq6oJznwo q8n10pfX+t4JBiRb3zaXs6BMm1BnQMdMiQqGBfsa8ydJ6BYRM+atO/LI7Ze1EwcMhyaX 2tnrZlEnK7pl+A1Tws90LhWcug/+9dUXHAUbpQGY/5MjMHJWDdVGDyKFbN18eL5y3lrR b0+w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l19si11660956edq.269.2021.03.10.04.23.20; Wed, 10 Mar 2021 04:23:43 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232993AbhCJMVa (ORCPT + 99 others); Wed, 10 Mar 2021 07:21:30 -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-kernel@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); -- 2.17.1