Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1705914pxp; Mon, 7 Mar 2022 00:04:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKgcBpnddBO2DWc3IiuUN4FYsv6rjTK5e0ob932RqykE9qeoQ9rEjzqHkJQvhPgRd6awYF X-Received: by 2002:a17:907:961c:b0:6da:68a5:426e with SMTP id gb28-20020a170907961c00b006da68a5426emr8510691ejc.188.1646640288843; Mon, 07 Mar 2022 00:04:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646640288; cv=none; d=google.com; s=arc-20160816; b=YRnrfeZbd4MJbBi3QcniKbFljaWrq7EX4sHCga+7tE1j0zPZQy4zlsUScbxWjyekyI Irs2TFX4mFL05UmHRH//T0wbAT+QK8cafzJSu8Cu69bsiQ6X4w8jhMJSkdJ6VMDdR+9V bZUU1RNT+UU8E7j5WvMaS1oVmBA7XiYo1RoC+s3Stz00NGcBTkFSChdCa4jsBqIlS5Ic fwYVUTrh1dD/qj0j2TV3PoQFbcpspd2gEN70ERoLGhy3ZO7+DJ/PgXReYXeZXSfOUxFt 6Bb2TS0pZtH2s2Ekh7Nm971Ao/X4K5gg5PxoTfJ1zddAW+XlnFDlb6g56iI+6eZnhy1t zOow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=NhLsJmRnH/aZkRKKqOMEsXjLi/7d+acph66kjRhUZF8=; b=EfzJ7vpCFvqEundDNIZZYX1ZCmBDOgP0Gnz+E9KSqVo50CA5dLA9UFBR2UZyJfFRj1 fHnJlZ8ofzN1QJPbiUgukUyqkVz8I/187XkPQSdmfXx/ZdpGQcB6xat8+3QIl77Pn43S BgsbjjfLvMsQINE/DpHQi7BZzJBricVYiaiTxTvwe2UbEtGxO54Z1n6T1tBgZkbDn0zV no/SgKBzHZdH4NUAwVVCfNKORhj7n8jQdrMt6PZHEmP4ic8GaM8hMgQqzls2yHfSz3GH G5EbPbC0x12oUEvW4AL++c3Bax0C7iz/R+Bvjl6na0+3M3+NY75RaDk7jyd4QVPeniDi zY6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t23-20020a50d717000000b00415a3351f04si7549890edi.561.2022.03.07.00.04.25; Mon, 07 Mar 2022 00:04:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235816AbiCGHga (ORCPT + 99 others); Mon, 7 Mar 2022 02:36:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235819AbiCGHga (ORCPT ); Mon, 7 Mar 2022 02:36:30 -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 DFA235F4FD; Sun, 6 Mar 2022 23:35:36 -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 9F011B80F88; Mon, 7 Mar 2022 07:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BF8FC340E9; Mon, 7 Mar 2022 07:35:33 +0000 (UTC) Message-ID: <2a3b4095-7b63-4da5-d0fa-43ba86715504@xs4all.nl> Date: Mon, 7 Mar 2022 08:35:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v2] media: st-delta: Fix PM disable depth imbalance in delta_probe Content-Language: en-US To: Miaoqian Lin , Hugues Fruchet , Mauro Carvalho Chehab , Peter Griffin , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220105115515.12196-1-linmq006@gmail.com> <20220301031253.6142-1-linmq006@gmail.com> From: Hans Verkuil In-Reply-To: <20220301031253.6142-1-linmq006@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miaoqian Lin, On 3/1/22 04:12, Miaoqian Lin wrote: > The pm_runtime_enable will increase power disable depth. > If the probe fails, we should use pm_runtime_disable() to balance > pm_runtime_enable(). > > Fixes: f386509 ("[media] st-delta: STiH4xx multi-format video decoder v4l2 driver") > Signed-off-by: Miaoqian Lin > --- > changes in v2: > - remove unused label. > --- > drivers/media/platform/sti/delta/delta-v4l2.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/media/platform/sti/delta/delta-v4l2.c b/drivers/media/platform/sti/delta/delta-v4l2.c > index c887a31ebb54..36ce0775f3f9 100644 > --- a/drivers/media/platform/sti/delta/delta-v4l2.c > +++ b/drivers/media/platform/sti/delta/delta-v4l2.c > @@ -1899,6 +1899,7 @@ static int delta_probe(struct platform_device *pdev) > err_v4l2: > v4l2_device_unregister(&delta->v4l2_dev); > err: > + pm_runtime_disable(dev); This isn't right. If the devm_kzalloc at the beginning fails, then it also jump to this label, but at that time no pm_runtime_enable() has been called yet, so this patch will just introduce another imbalance. You *do* need a new label here (like you did in v1 of this patch), and update the 'goto err;' instances after the call to pm_runtime_enable() to go to that new label. Regards, Hans > return ret; > } >