Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3706469pxb; Mon, 24 Jan 2022 15:56:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhSC40+JwlyXQr4UwfifK5g5yaXKfinOQtVQKbn09r3/59lKZSOKVBqLXCj0emDrCvTyz7 X-Received: by 2002:a05:6a00:1511:b0:4c4:330:b86d with SMTP id q17-20020a056a00151100b004c40330b86dmr13859211pfu.82.1643068467853; Mon, 24 Jan 2022 15:54:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068467; cv=none; d=google.com; s=arc-20160816; b=DJvJg0XZi7PRS3aX9cs580B/U4ANmzggHPH01+zAI9FOKZ067p0cDpSFospTIa/qKk TP27qTR+Je4OKruTnIAHr8bAdQm+EyjX17pyRa94KbDcpLmIAoaCKism+uRzLuI9uj/M 8X5KYzdLEuiXdZKtcLSgT7VLNk7zOVbf9tfJdcX8Z01FPvrK0/bh57RYTntNy6nkckh4 yqc+TTt8MvbItmQajpdKbVVpuzkxVSLEoL3X7kuE3Ii7BIDdOe8DkR38wqkCCUfAZ/AV wTd3RK+T6KvvPn5qPd4kMT1DB6eWa1bDEFCmFmAPWFY1ub6vr7BZN06iZgHn2/LqEfJ/ y1QQ== 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=7FUrYqqozdDOUCl9WiS6a36u3W2O5+QbR8X39OT5adw=; b=we3tQsUjU70BmwqGa9BdDFS98F+yatsMsdgU0gP35V4bLq8gJcCdyt0MgN9Vz322rp FYJRliLrbhf6cafJNVf6yH8V3GIK0JQuyTTRrzh4AARFlpQLsJq9uEu+9foivj0cUoUr wVJ1XV4/ijGBQOsgVoZ0o8R/vjklcfelMe4dM1nVAnng7itg1tFOKG7juiJ5qOa0dwFl gKY0d+twDffb+SDhKFjE9e23Dhnjrz/IHa05roEKMMzPhNH9gMrQP3NsNk39791oRJoc pu9wE6066qtE5tZ05ACHIE04hbo+C31U+fdFEqZZGeqQfcZpw0bowuIEe3Cu1kUKXuM6 V/FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m325YtP4; 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 p5si1332012pgj.499.2022.01.24.15.54.15; Mon, 24 Jan 2022 15:54:27 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m325YtP4; 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 S2360779AbiAXXr5 (ORCPT + 99 others); Mon, 24 Jan 2022 18:47:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588742AbiAXWyE (ORCPT ); Mon, 24 Jan 2022 17:54:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00A82C06136F; Mon, 24 Jan 2022 13:09:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B19BEB811FB; Mon, 24 Jan 2022 21:09:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDBAEC340E5; Mon, 24 Jan 2022 21:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058556; bh=a9+AARr8CM66RUDoLU7UW29S2ykRGDh6pu0ykWhcya8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m325YtP49Z/1WoxtWYEnXAKcDJdOEJLHZ2UHkJ46bq4xKAMy+G+KS/VuEa11CvtVq ISBLHqakc/xyoxOa4P7utEhYMwAH11SfMEk2XjLYuIKOBZ+D/Mzv5MJ+taoHC67uGK HEImeUYxG37p+bARC/bWSzAymFxuwc+Hd+jErEbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Andrzej Pietrasiewicz , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0300/1039] media: hantro: Fix probe func error path Date: Mon, 24 Jan 2022 19:34:49 +0100 Message-Id: <20220124184135.389465865@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Jernej Skrabec [ Upstream commit 37af43b250fda6162005d47bf7c959c70d52b107 ] If clocks for some reason couldn't be enabled, probe function returns immediately, without disabling PM. This obviously leaves PM ref counters unbalanced. Fix that by jumping to appropriate error path, so effects of PM functions are reversed. Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver") Signed-off-by: Jernej Skrabec Acked-by: Andrzej Pietrasiewicz Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/hantro/hantro_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index fb82b9297a2ba..0d56db8376e6a 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -960,7 +960,7 @@ static int hantro_probe(struct platform_device *pdev) ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks); if (ret) { dev_err(&pdev->dev, "Failed to prepare clocks\n"); - return ret; + goto err_pm_disable; } ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev); @@ -1016,6 +1016,7 @@ err_v4l2_unreg: v4l2_device_unregister(&vpu->v4l2_dev); err_clk_unprepare: clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks); +err_pm_disable: pm_runtime_dont_use_autosuspend(vpu->dev); pm_runtime_disable(vpu->dev); return ret; -- 2.34.1