Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3661282pxb; Mon, 24 Jan 2022 14:44:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwa5ICIlwbYIDy/bDw8jCQEvmz8lbQg03HMDh59m3tueGdSBGW7fHGZJJDPgqAqZs/lKtXn X-Received: by 2002:a17:90b:1b04:: with SMTP id nu4mr509734pjb.214.1643064251282; Mon, 24 Jan 2022 14:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064251; cv=none; d=google.com; s=arc-20160816; b=Apac2R7iSeWpFtxFT6Gh566ZClN8+7wUv1oIQqvmpZYUEV57QBgDN22NlC3D7NNwU5 o5jiEk3EVwDGm9uYgSS+gH4GFB8EMyy40jErWI5TiSGP6W0flLFzyIKoXQBCiUyWMJ5E DfybI04XQxEzQZyz7rH6uMoy9nBwTge/QGpPbKcfP3SUsxQZzue2QjT/jFeUXdvfcSDb GYX6A4aByFAnXhqP+uR2+jVGmBfL9NcCL051FAd7jZdQaSUgJZTWruiHN39vaA0UL05Z Ku6QqXoYTu4ANDXqUJPo2OvjoJ5+yrKXk5ZGOh4HFb4CNdYpitPMCsfP21gS7zOwUisY UaDw== 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=q5epZ6sW+Ef5TdhvTXofRym8MLDop2AECHc8Mx7fJOU=; b=c7gu/G6S8g2tQYZFYHL7tBPhyAj/mgKjEEDp3nG+9cUH0PA14YGJo/bST9CZ2+935k 4zh2amFpTykRtUQ4exfyNiEIxW+RvUbR9wgUrbX9KwdOFtZGNQha3tUOwiwjRr0VGV5Y /AakSmrtRP6NJpelh+xn1yB6wyar2qh1MSISsGVgOpCy5C9JRWkUpWy7HkQub0HVKW6L YYywMtJxB3SM/7tMhVpodjU12dcif71OuRWM794FyEkOvuxZQCWWaPxknIwNKIIOAkW0 dVspDhC/vmv1hV1GaSYzuiJCfwcKNSlY/ZeCbpR0hDyheebla5o+q8rwetAdEBmsumlK aTqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vRPYbToM; 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 p23si15656034plr.190.2022.01.24.14.43.59; Mon, 24 Jan 2022 14:44:11 -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=vRPYbToM; 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 S1837133AbiAXWmX (ORCPT + 99 others); Mon, 24 Jan 2022 17:42:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456473AbiAXVjV (ORCPT ); Mon, 24 Jan 2022 16:39:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA4D5C0BD13A; Mon, 24 Jan 2022 12:24:26 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 48D2B61491; Mon, 24 Jan 2022 20:24:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29AAAC340E5; Mon, 24 Jan 2022 20:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055865; bh=JsVz2sUfH7WOUgTsYre59fFZcBLlzrlCYfHWOHIFs50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vRPYbToMyr6CxfSHEHtbnAzwp51kKAtJxxvGq/UIDrQK52wy9vJ6ZKIHYOiChiiwb YwV7SRKIbzuBBjzv7b46/7K4lZuyKApZZCOt3tPfvnJ0kKdX0ROR6kNeezRyPxO5tO HVWPbmxhKVfBdHdbUwWi3tVZkEBUjh6MQSA6Dg3k= 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.15 258/846] media: hantro: Fix probe func error path Date: Mon, 24 Jan 2022 19:36:15 +0100 Message-Id: <20220124184109.830158122@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 20e5081588719..281aa585e3375 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -958,7 +958,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); @@ -1014,6 +1014,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