Message ID | 20221107224656.278135-3-mcanal@igalia.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2343306wru; Mon, 7 Nov 2022 14:54:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM41KkPcUeBDcmyFCqvTydmZqSKTJa/CTwQAjQbOZmhYxlYKd0exRR7AavtF/aRxTFdlYXtl X-Received: by 2002:a17:906:edc2:b0:7ad:9f04:1c15 with SMTP id sb2-20020a170906edc200b007ad9f041c15mr49083959ejb.559.1667861640742; Mon, 07 Nov 2022 14:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861640; cv=none; d=google.com; s=arc-20160816; b=aqZwtkyD9DSMBeL1BYQGsc6lxQC+aq7ef0CNvp/npkzXcU2mewYH/M/wA3ss4ChEIj Q8t2+XrDCh03npVpWALaSJtLmvuHHM1S1uN14wmfhAakcW/I6Jtk8d/d1vn6PL1ORtVU FWx+SgzEZnFYG3WSJQXpeTE0cYAEqKoyyIEBxWpzr/KHPi17xaRxc6QN5zaUWfHIsBGb SzBXSmsfEX0ftrOmnAY4KLry/Vn8da6T6yDIBIQ4CQYWZAgDt8EYJrBKXC1PeIyx4ETa ySPifJ7G2BUrYNyMsov8xyJsob2uoVUQ8M9loHw7Kg5QtRZ23exnKfbN6WeCTGOAl/YD VmWA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=N58UJpNNAExktwhfZVLTshsZnQ2VVILEtn44kEC8lhE=; b=V60blCuX81XKeoIr+5RqNldfDz178M4Cyh8/1oXNOg/wKPU8/2Xj/6MGXghU1Lp6cQ 0ENXLIy1XggE6npEVWhNFFBMJKdCcFnEWmK26B6HGae9d3Yz2FG4vaK8F6cbK35UJX6l bjgpte0OEmRA7FP9LyF6VwZ93UOsSFgOCtPdf/hl797PZFwYua2mlA8/ChaX13WOjVQ1 aFWj+2oGc2rUJmUjlFMoDWulZSwH6S4lMvOknUe+L1Q8m8FJBKlpD6dRxqxpgCi6SCpo L/7dZRbYTyAB8uMTrxFjmaGndJhw9ShPdKx9NdiUPuJfooswvqN4bFNa2kc7mpnkfRRK atvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=aBTAUl7E; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z7-20020a05640240c700b00451e1aae675si10818923edb.547.2022.11.07.14.53.32; Mon, 07 Nov 2022 14:54:00 -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; dkim=fail header.i=@igalia.com header.s=20170329 header.b=aBTAUl7E; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232706AbiKGWsv (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 17:48:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232679AbiKGWsm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 17:48:42 -0500 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D86192AE1D for <linux-kernel@vger.kernel.org>; Mon, 7 Nov 2022 14:48:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=N58UJpNNAExktwhfZVLTshsZnQ2VVILEtn44kEC8lhE=; b=aBTAUl7EESx7XqVKDnD6YS7wbj 8/vNDRacf5mqYJTrbPEn+ZEhFXJmKIZAq537t3odJDE2x9hKTX4hzTkK7xoRewIxuTHz8ZvfINQrM 8trMpHc+FYEYh7MumOFYd1uACya663nsFCtK+imVa5c8s5MUnC/OMtBVwau/H2gHIgO72gc6C/R30 0TIQq5EfB2xhLe/DIl5cY16ASG6VjyDD6zFlb2o3GUfMdcSSLVuaQJdyZ72u60AfEzfC6UG12gsOq nRz7jSuoVzZvGAH3/X8FK7M3fX26tTWljUqPeUX93a5wrs4tpIao/81IOQvcYU8lPh9l+dowMw558 AvVFSEzA==; Received: from [177.34.169.227] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1osAuz-00E9qX-5g; Mon, 07 Nov 2022 23:48:37 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= <mcanal@igalia.com> To: Melissa Wen <mwen@igalia.com>, Emma Anholt <emma@anholt.net>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Cc: =?utf-8?q?Andr=C3=A9_Almeida?= <andrealmeid@igalia.com>, "Juan A . Suarez" <jasuarez@igalia.com>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?q?Ma=C3=ADra_Canal?= <mcanal@igalia.com> Subject: [PATCH 2/2] drm/v3d: add missing mutex_destroy Date: Mon, 7 Nov 2022 19:46:56 -0300 Message-Id: <20221107224656.278135-3-mcanal@igalia.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107224656.278135-1-mcanal@igalia.com> References: <20221107224656.278135-1-mcanal@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748879688226506920?= X-GMAIL-MSGID: =?utf-8?q?1748879688226506920?= |
Series |
Balance mutex_init and mutex_destroy calls
|
|
Commit Message
Maíra Canal
Nov. 7, 2022, 10:46 p.m. UTC
v3d_perfmon_open_file() instantiates a mutex for a particular file
instance, but it never destroys it by calling mutex_destroy() in
v3d_perfmon_close_file().
Similarly, v3d_perfmon_create_ioctl() instantiates a mutex for a
particular perfmon, but it never destroys it by calling mutex_destroy()
in v3d_perfmon_destroy_ioctl().
So, add the missing mutex_destroy on both cases.
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
drivers/gpu/drm/v3d/v3d_perfmon.c | 2 ++
1 file changed, 2 insertions(+)
Comments
On Mon, Nov 07, 2022 at 07:46:56PM -0300, Maíra Canal wrote: > v3d_perfmon_open_file() instantiates a mutex for a particular file > instance, but it never destroys it by calling mutex_destroy() in > v3d_perfmon_close_file(). > > Similarly, v3d_perfmon_create_ioctl() instantiates a mutex for a > particular perfmon, but it never destroys it by calling mutex_destroy() > in v3d_perfmon_destroy_ioctl(). > > So, add the missing mutex_destroy on both cases. > > Signed-off-by: Maíra Canal <mcanal@igalia.com> > --- > drivers/gpu/drm/v3d/v3d_perfmon.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/v3d/v3d_perfmon.c b/drivers/gpu/drm/v3d/v3d_perfmon.c > index 48aaaa972c49..292c73544255 100644 > --- a/drivers/gpu/drm/v3d/v3d_perfmon.c > +++ b/drivers/gpu/drm/v3d/v3d_perfmon.c > @@ -113,6 +113,7 @@ void v3d_perfmon_close_file(struct v3d_file_priv *v3d_priv) > idr_for_each(&v3d_priv->perfmon.idr, v3d_perfmon_idr_del, NULL); > idr_destroy(&v3d_priv->perfmon.idr); > mutex_unlock(&v3d_priv->perfmon.lock); > + mutex_destroy(&v3d_priv->perfmon.lock); > } > > int v3d_perfmon_create_ioctl(struct drm_device *dev, void *data, > @@ -177,6 +178,7 @@ int v3d_perfmon_destroy_ioctl(struct drm_device *dev, void *data, > if (!perfmon) > return -EINVAL; > > + mutex_destroy(&perfmon->lock); This one looks wrong, I think this should be put into v3d_perfmon_put. There is also an error case in v3d_perfmon_create_ioctl() that I think you missed, right above the kfree(perfmon). With these two fixes this is Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > v3d_perfmon_put(perfmon); > > return 0; > -- > 2.38.1 >
diff --git a/drivers/gpu/drm/v3d/v3d_perfmon.c b/drivers/gpu/drm/v3d/v3d_perfmon.c index 48aaaa972c49..292c73544255 100644 --- a/drivers/gpu/drm/v3d/v3d_perfmon.c +++ b/drivers/gpu/drm/v3d/v3d_perfmon.c @@ -113,6 +113,7 @@ void v3d_perfmon_close_file(struct v3d_file_priv *v3d_priv) idr_for_each(&v3d_priv->perfmon.idr, v3d_perfmon_idr_del, NULL); idr_destroy(&v3d_priv->perfmon.idr); mutex_unlock(&v3d_priv->perfmon.lock); + mutex_destroy(&v3d_priv->perfmon.lock); } int v3d_perfmon_create_ioctl(struct drm_device *dev, void *data, @@ -177,6 +178,7 @@ int v3d_perfmon_destroy_ioctl(struct drm_device *dev, void *data, if (!perfmon) return -EINVAL; + mutex_destroy(&perfmon->lock); v3d_perfmon_put(perfmon); return 0;