Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp19570156ybl; Sat, 4 Jan 2020 04:26:06 -0800 (PST) X-Google-Smtp-Source: APXvYqwhpw6S9dRuaaU6GSJVIJiIolhngPEm3cQBKLQ8/ROKn6JrDbj5UmuHARmHHmLIlN8FbgN4 X-Received: by 2002:a9d:7590:: with SMTP id s16mr98019999otk.89.1578140766484; Sat, 04 Jan 2020 04:26:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578140766; cv=none; d=google.com; s=arc-20160816; b=LpdPOuQ0r8y2xSzQMWRqGvvoXbAAlhCVNs+guoL2fm8CP3JaN41fqdpZbMW57kHcmj nabn2CO0+z22AAzCirgVZl1AIRWka6WgvOkvVtvWsHUzMs1kW5pBdopgcD3FtYj9GzHj SbsKbiUyq5+DEt28U7oV6NiY8t+w/XtAPuj62fZE0AYN/59Jh0xbxMyYrOBbWxUTcLFk LaxOvJwDtZXkk8VNGYR88Jr6AA4NvPQGEDKVbk4yn5eK2POYtfpcbvRKBlkDkdaUl/U/ Jsmp8ax+/47G1xrXHZVaWzjdKLZPoG9GIWzoxAUsqilcKQyWsjN94niL5aZAhMPZ+eEK otxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=zwNUSd99uCpcD2i/Zhi09ZcL/ngKkzJPJ00O7NK8uak=; b=xWmxIeygGo2EfYQofks27w0AkFsPnSH6a0blSI1wXkE74CojsTPJxoppsiVHiaMU8R PH1c1S6+G6yYo68Lk2bNqUEXtHnV9qZzjiJbg379qIUcm7iiYSuR/Ni8AI/yayHxOioM 7JhPI7nL0CRCuNSj6+QbPkyZgkEL1jfHjsHkIy9hHd3yihO8mN+yaB0I5gYP3A/MNmZt A+miThPYKLk4NSnDnaAA8CFIPJXrcnHtfyVOXDo0mxf2gTWRhbJphABFlImv4oVj7EvU 20RvJscSRrdA1vhv08UQIVAOHLmo0unDLriaKPA+MweV+zAn9oIfKbYZJTZeKh89aT1o Pi8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IfTd8sm1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s129si30513272oig.177.2020.01.04.04.25.54; Sat, 04 Jan 2020 04:26:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IfTd8sm1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725946AbgADMXW (ORCPT + 99 others); Sat, 4 Jan 2020 07:23:22 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36443 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725812AbgADMXW (ORCPT ); Sat, 4 Jan 2020 07:23:22 -0500 Received: by mail-wr1-f65.google.com with SMTP id z3so44798704wru.3 for ; Sat, 04 Jan 2020 04:23:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zwNUSd99uCpcD2i/Zhi09ZcL/ngKkzJPJ00O7NK8uak=; b=IfTd8sm1QFVaGBFpKEd2oviq06KevNXtkX8yOkcbAfoA/loOfqRuxsDuAIl+7o48RH MSQEDOb1T81BxBwJxy5VfiRMx3OZz7EGSB+++T81oGS2K67N0qr86+S7tNcHwTsyXMh8 yxZQFVfHiv4Z79srxGd4VVTYYh+SuNKGV7d+yhhEYLou6OmAZk0cNSG11m8vRXHDpR6v 7DaLWosJ0wFwOh/LQhuxWHn/86XYWgtAJWmeOVic27RwCYORDqmaOK+mk/3nGuKiyvv0 0U7ZKg1A/dBNlW5n9hlSoXgvJJR7y7E+V6Lrzf1Bh8tHIb0hnrmvpjVmuc+TweyCWkEe ravg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zwNUSd99uCpcD2i/Zhi09ZcL/ngKkzJPJ00O7NK8uak=; b=UmeHIqCfKtkvDik1l1/VIYnQ7PAsh65G9oHMzrzycAOtNcnHzm0COKq9ZdhobE0/fW KK53Nxn0zkxBcrt9A4OdGaFekx1pF32I9ZHHM18UPpcnHzgzaZfqe1PkQvUO8ynGKwjc BCSRe4dUkHldOyaEJdyFQd//fXT7ORe0jcBLC0T60HDdubJaECxQ7Fkp5e4WA4Lw/ApP FJ6jgs+qPkNiiN/PDzWmpju62OamJd69Ls6fsYgbeYhUzfaJQyfl4XH+EOqbiqwHEVX/ vs6SV82qBrEz73E/GTJUhar/eV6Yu/yEHOzmtXVxfQAlrKToOMWMsF0ZiyAJuo+ldfDj oZMw== X-Gm-Message-State: APjAAAX4Ul3bXNY8eE0tGlaOsw8dMavdgekpkL/dEZP/rj4nFSqcof+4 qMl5L6/cBZD/K2iaCVqLp10= X-Received: by 2002:a5d:620b:: with SMTP id y11mr90778799wru.230.1578140599973; Sat, 04 Jan 2020 04:23:19 -0800 (PST) Received: from localhost.localdomain (bzq-79-176-206-154.red.bezeqint.net. [79.176.206.154]) by smtp.googlemail.com with ESMTPSA id x1sm63227093wru.50.2020.01.04.04.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jan 2020 04:23:19 -0800 (PST) From: Dor Askayo To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Dor Askayo , Harry Wentland , Leo Li , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter Subject: [PATCH] drm/amd/display: do not allocate display_mode_lib unnecessarily Date: Sat, 4 Jan 2020 14:22:15 +0200 Message-Id: <20200104122217.148883-1-dor.askayo@gmail.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This allocation isn't required and can fail when resuming from suspend. Bug: https://gitlab.freedesktop.org/drm/amd/issues/1009 Signed-off-by: Dor Askayo --- drivers/gpu/drm/amd/display/dc/core/dc.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index dd4731ab935c..83ebb716166b 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2179,12 +2179,7 @@ void dc_set_power_state( enum dc_acpi_cm_power_state power_state) { struct kref refcount; - struct display_mode_lib *dml = kzalloc(sizeof(struct display_mode_lib), - GFP_KERNEL); - - ASSERT(dml); - if (!dml) - return; + struct display_mode_lib *dml; switch (power_state) { case DC_ACPI_CM_POWER_STATE_D0: @@ -2206,6 +2201,12 @@ void dc_set_power_state( * clean state, and dc hw programming optimizations will not * cause any trouble. */ + dml = kzalloc(sizeof(struct display_mode_lib), + GFP_KERNEL); + + ASSERT(dml); + if (!dml) + return; /* Preserve refcount */ refcount = dc->current_state->refcount; @@ -2219,10 +2220,10 @@ void dc_set_power_state( dc->current_state->refcount = refcount; dc->current_state->bw_ctx.dml = *dml; + kfree(dml); + break; } - - kfree(dml); } void dc_resume(struct dc *dc) -- 2.24.1