Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4024748ybg; Sun, 7 Jun 2020 18:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsR43QMgbMu5HRdnBlHMCZT87TU+KwAlH29nzxiUUWpyRHZSqqE5FERkEeA7OZjUdsXh4U X-Received: by 2002:a05:6402:1d82:: with SMTP id dk2mr19454671edb.75.1591581459701; Sun, 07 Jun 2020 18:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591581459; cv=none; d=google.com; s=arc-20160816; b=Dgogo7fQ88WARVx2Nylk2aVstZ1qnpPeahgHXJvhYXzVtcyGw+GyBCKW63to1iUJbw T70OQHLFOAwYb4aLRTf7wxYtjWRXQM9ZL2L6jVn4xWQuq7WVuukSpH4FIlyE4LpgRwfq HfgmRJiKo6vPI307yAXMLRivx9RCVffBDfQC08KbhKLEdv2tqG+WPBKhI5L/57uWZdJx DsPl8jrowZZMwJHuEnLNM8hrPoxi6XFp5dvosPH3US1JvTLPkuMkN6baNDFnM3ToycDa dW90mmQp/L4359L9lcEOcenA6ieg/+alzTcwvzddAFpAePieQwHbKop5QZjf0ZG2LHup lTIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=u4lFiwRxi98ktLnSN7ES0FICiF1thvxGQ4ijJiUkeSI=; b=EWMIBqHb2M3IHcPnzH7RkbuJDklEa/O6cTzlXrSwAShdmHlpbEN45tN3AXD5qpZDTz 1YyG01hwNx3L5Pf4s0qHLGl+ySqIGzpqS9a8DduqEDowdVEj2oIojjBYllfObvjvht/P 5hFM1NYu5EX2kQL0J/GZN5KPtL9RujkMH6z2b/a+cQImxSP2utHzIF6rF7g18BPdQpiT lcnfb/tait75WJBJEs6o/4npKvZD43QgqgKMY/5WlXURy79L8ZtXGvZw5mONfvS1kQ7k rgOeZrNnXz1RXzh/tMucJwJc1ICszh379QuYyrnWWVXF72/Dvj7D7Spvi4KH+glINNcV +UcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=NPCCtVM9; 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 j17si8085075ejc.223.2020.06.07.18.57.16; Sun, 07 Jun 2020 18:57:39 -0700 (PDT) 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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=NPCCtVM9; 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 S1728802AbgFHBzS (ORCPT + 99 others); Sun, 7 Jun 2020 21:55:18 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:48562 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727871AbgFHBzS (ORCPT ); Sun, 7 Jun 2020 21:55:18 -0400 Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C25B024F; Mon, 8 Jun 2020 03:55:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1591581316; bh=CthNpIqftGchRHdnCTWbVdTQG6Z9SbHT2rIpOWme35Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NPCCtVM9aMDQy37szWgmy93G2oQZoDzXt/F+u94gKh9NLoxp/WmJEHRJm4uhvvj4N oLbIYFQ4qn34ZFbvwJJr9X8z3fv1aF+ByGknhxh8jTBv9yo6BfrVywpmWixvrG6JJb lTpC3fFDr7YydWN+Pkef67H5fijOZ3YliO9UKVB8= Date: Mon, 8 Jun 2020 04:54:56 +0300 From: Laurent Pinchart To: Dinghao Liu Cc: kjlu@umn.edu, Kieran Bingham , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: vsp1: Fix runtime PM imbalance in vsp1_probe Message-ID: <20200608015456.GJ22208@pendragon.ideasonboard.com> References: <20200523115426.19285-1-dinghao.liu@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200523115426.19285-1-dinghao.liu@zju.edu.cn> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dinghao, Thank you for the patch. On Sat, May 23, 2020 at 07:54:26PM +0800, Dinghao Liu wrote: > pm_runtime_get_sync() increments the runtime PM usage counter even > when it returns an error code. Thus a pairing decrement is needed on > the error handling path to keep the counter balanced. I wonder how many bugs we have today, and how many bugs will keep appearing in the future, due to this historical design mistake :-( > Signed-off-by: Dinghao Liu > --- > drivers/media/platform/vsp1/vsp1_drv.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c > index c650e45bb0ad..017a54f2fdd8 100644 > --- a/drivers/media/platform/vsp1/vsp1_drv.c > +++ b/drivers/media/platform/vsp1/vsp1_drv.c > @@ -846,8 +846,10 @@ static int vsp1_probe(struct platform_device *pdev) > pm_runtime_enable(&pdev->dev); > > ret = pm_runtime_get_sync(&pdev->dev); > - if (ret < 0) > + if (ret < 0) { > + pm_runtime_put_sync(&pdev->dev); > goto done; > + } This change looks good to me, but we also need a similar change in the vsp1_device_get() function if I'm not mistaken. Could you combine both in the same patch ? > > vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION); > pm_runtime_put_sync(&pdev->dev); -- Regards, Laurent Pinchart