From patchwork Mon May 4 14:05:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 6326951 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D261FBEEE1 for ; Mon, 4 May 2015 14:05:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10BCA20351 for ; Mon, 4 May 2015 14:05:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2C18E20320 for ; Mon, 4 May 2015 14:05:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D9F36E3D3; Mon, 4 May 2015 07:05:43 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 112ED6E3D3 for ; Mon, 4 May 2015 07:05:42 -0700 (PDT) Received: by wgso17 with SMTP id o17so151436285wgs.1 for ; Mon, 04 May 2015 07:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zD0uorGnfZDKM0Ac4Ko3cp08vYg9Q66QnG5cjwF91rI=; b=sumNJkhTTQ5czhQfNFcZbE6PTl+l4YNp+YSERzn2Mkvb3cpzo1pMrq8muIMsYy7qvg wI3vhFBJhgFm0adnAC9wsjq1rsHpGCDej9ToHaC/py9FNk6dI685wcqGbTUAmYOeCJEK GjwL9mi+lWG6fFtcB5uiZsPt2FABhoIG/Zab5qufNJxZLv4z1I9rsXCl5XE2Vz64gPbo azQ7Ug4HREAuSzz0jne/KVcTSHbN4wUjTXHjwHjp4iVWaDVNb/verV3bG9o6w89ccEkF w0LBDsBBVEWdOsRaZOorKLChhRgos2IqwYEXGAjhAoIDILIQIkTWTdTqNXcq795a0F/H mXAQ== X-Received: by 10.194.109.229 with SMTP id hv5mr30548339wjb.119.1430748340965; Mon, 04 May 2015 07:05:40 -0700 (PDT) Received: from david-t2.fritz.box ([37.120.123.242]) by mx.google.com with ESMTPSA id 9sm10665649wjr.11.2015.05.04.07.05.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 May 2015 07:05:40 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm: simplify master cleanup Date: Mon, 4 May 2015 16:05:14 +0200 Message-Id: <1430748314-862-3-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 2.3.7 In-Reply-To: <1430748314-862-1-git-send-email-dh.herrmann@gmail.com> References: <1430748314-862-1-git-send-email-dh.herrmann@gmail.com> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In drm_master_destroy() we _free_ the master object. There is no reason to hold any locks while dropping its static members, nor do we have to reset it to 0. Furthermore, kfree() already does NULL checks, so call it directly on master->unique and drop the redundant reset-code. Signed-off-by: David Herrmann Reviewed-by: Chris Wilson --- drivers/gpu/drm/drm_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 88b594c..3b3c4f5 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -132,15 +132,10 @@ static void drm_master_destroy(struct kref *kref) r_list = NULL; } } - - if (master->unique) { - kfree(master->unique); - master->unique = NULL; - master->unique_len = 0; - } mutex_unlock(&dev->struct_mutex); idr_destroy(&master->magic_map); + kfree(master->unique); kfree(master); }