Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4008706rwb; Tue, 8 Nov 2022 10:51:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf6l+tVSQuO/o5bweELVpaHq243Y/V0ncZMJCgq98/EoEvdh/bIyhGvNFBo9RlYmSBsXewVv X-Received: by 2002:a17:906:3e95:b0:7ae:6cdd:9b9f with SMTP id a21-20020a1709063e9500b007ae6cdd9b9fmr9912523ejj.296.1667933470267; Tue, 08 Nov 2022 10:51:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667933470; cv=none; d=google.com; s=arc-20160816; b=vOSeqNpk9Wlqj9PQN7iJiVfD1BFjWqNtVA3wtrOuBRSA/HIldMsNxPnrynwUTgBwKV Vd2yNeSgVBFwG212fvejanFbCXsA8Skfs/unSI2e2DAB6437k87WiIREp22GsDxAxJug PBArCUIZfIoTYvvugzrT8moER0MTp+UIsMGma4sIfdm4YkFTOaZ4aJ7hQU4wKQPDZxkt DaWCYVLVK4xFE+7zSquAHZvMQH6edT45VlsVh05LmuOmMdcVgQ1HgqpWj9i/tZJOKshE a3X74S/0o7rwCNgORHlycIjwd7lewSrmLlp86Ghgu50zjIRI3gaO2bwqybQ7FFxZBDhm ygqw== 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=ukvrU4BRwqv/hi5Lb7tXJdxSLVociGC6eZ07IJrOiWk=; b=xmHRPiqU6y2LgOEWPFJGj/Rvcudwo8EgmlBt7ciHIxOUWkSM17PRcD2ttTT1+yCjO8 XRc1hU49lvylYgpkZ0siEtRGnOaK51BVS2J3gokRkmU9cuZAgmjEcjp093lADE7ilxt4 dTnHxr9dNMMMwtcNg8J8k2dfy0NXx0ZWinwoSqduU0LK8u/8QxBKPB888whJxNJILqBh dxPpPhYHCfnEdEiO/EguOYHkhh4O2ttpwN4PkUtDqejrnOSg/WKzZdCMGTUGsNW3oh1P 4IH2JcXZ7fM77l3Ty7bqc/+QbIZRhVpw8bLQXltFYn1rozliGnBg4pdrrRVHAGp2M/Zr Asog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b="qwnYcD7/"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020a05640251ce00b0045154775089si14668182edd.625.2022.11.08.10.50.46; Tue, 08 Nov 2022 10:51:10 -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="qwnYcD7/"; 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 S234730AbiKHRy6 (ORCPT + 91 others); Tue, 8 Nov 2022 12:54:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234704AbiKHRyt (ORCPT ); Tue, 8 Nov 2022 12:54:49 -0500 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 308561AD8F for ; Tue, 8 Nov 2022 09:54:46 -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=ukvrU4BRwqv/hi5Lb7tXJdxSLVociGC6eZ07IJrOiWk=; b=qwnYcD7/yDMEdogFwt4kmfJ7RC isnolX2gNmqTtIvI30j0dAzZ0o+jKxkr2PwN3KWbziKiPJmiuXLSHaEcbtPlUX7a1hvQlCZCFZ/VQ S9JBnxjOVY5QCpObtqQ0Nx0twHYNZJomXyotVgYqdB3MTHV4/dVlm/DomTXkv4okcQP5X39SstZIl cV+V+GIvtH+rUgAVwxu/aLNlcSR1HIMV6nIOwDAAPWjB3Mn/fUER2n2R5/tYmF5hPf//HDvuLrc/7 DDXmJnepWBKtzAJ6g+PNLpHJiWQy7Fi32ghmYjvpgYkeFq1xY3+45LwlmBAg0z3bkbmNsCP2NPEYj bVq4ydIw==; 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 1osSo5-00EVxA-ED; Tue, 08 Nov 2022 18:54:42 +0100 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= To: Melissa Wen , Emma Anholt , David Airlie , Daniel Vetter Cc: =?UTF-8?q?Andr=C3=A9=20Almeida?= , "Juan A . Suarez" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Ma=C3=ADra=20Canal?= , Daniel Vetter Subject: [PATCH v2 2/2] drm/v3d: add missing mutex_destroy Date: Tue, 8 Nov 2022 14:54:25 -0300 Message-Id: <20221108175425.39819-3-mcanal@igalia.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108175425.39819-1-mcanal@igalia.com> References: <20221108175425.39819-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: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Daniel Vetter --- drivers/gpu/drm/v3d/v3d_perfmon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/v3d/v3d_perfmon.c b/drivers/gpu/drm/v3d/v3d_perfmon.c index 48aaaa972c49..e1be7368b87d 100644 --- a/drivers/gpu/drm/v3d/v3d_perfmon.c +++ b/drivers/gpu/drm/v3d/v3d_perfmon.c @@ -17,8 +17,10 @@ void v3d_perfmon_get(struct v3d_perfmon *perfmon) void v3d_perfmon_put(struct v3d_perfmon *perfmon) { - if (perfmon && refcount_dec_and_test(&perfmon->refcnt)) + if (perfmon && refcount_dec_and_test(&perfmon->refcnt)) { + mutex_destroy(&perfmon->lock); kfree(perfmon); + } } void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon) @@ -113,6 +115,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, @@ -154,6 +157,7 @@ int v3d_perfmon_create_ioctl(struct drm_device *dev, void *data, mutex_unlock(&v3d_priv->perfmon.lock); if (ret < 0) { + mutex_destroy(&perfmon->lock); kfree(perfmon); return ret; } -- 2.38.1