From patchwork Tue Mar 21 17:58:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 72980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1943451wrt; Tue, 21 Mar 2023 11:35:24 -0700 (PDT) X-Google-Smtp-Source: AK7set+z4ROeQq3kh1Wp3++HKpVdrDlaykLJ3o6OPwv335ap4Pyv3FGEX7TyxsFOsl1sGY5UgY6i X-Received: by 2002:a05:6a20:1454:b0:da:35d1:c46a with SMTP id a20-20020a056a20145400b000da35d1c46amr5452560pzi.9.1679423724138; Tue, 21 Mar 2023 11:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679423724; cv=none; d=google.com; s=arc-20160816; b=KbJ+5dO8DjqZvSwQjYy76vINfMLjQsiIWjve3Iq/FsZDSf6KeFVVYLG1Edl41F9/5j iamz0/R/xqg8AsFicAoPNqAVvLgTJVcb5rM+C6dSINnED3kzGblvvwewCikcdxmcZVT2 o7hRy8b0N7UfMWjjeU15P1t/ZvDxEo5m5HUiz5JUKU383t2qICfUdVEch2cyxbJGnFln aXT4ORw4rAiJLalZjb+Wqqgqzh3W3q8Wi0bbhC+9rRibG70rED4OyWxyuWMGD5nzOm37 /BpjbpkESDWQ9/e2Ru7idwAut0SZVj1qAvosNlDbuGH/2/aG+xy8iRQXL93/iooAzmOI 1BZQ== 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 :message-id:date:subject:cc:to:from; bh=L/tSWWD0k6Be44JDyOPd4MjXyw0pa7QTmHFvlw/iWII=; b=LiY89Zgv4/K/IOB4sles5dax/2NA4OQmd7igG57ez8xHIDevuXYNM/xTQKlt/DtyLO Ey5vCQ0f80X7SPSF3QhCKXuVNjjSQkDgcJdIIe07RM/HHsMYAA9MjnbMaLB9Hwx4hwyy +jHDWduGM6t4T4aDL607tQXkmit8CDO7a3RQn7lZuF0FkTx6tvAGlMM1/kgLgYUjRHBP PfX97n4mnMOEJ4suv2uVFCJUIMR0pxelT3Ajc3b7Z37OdpDPa6y1vuOI7Mvy2dHQ/xQr ylDLF3/Cu7Hz/WtZUpAAj6Gp62dGSrfCCiZTuCJ1FdPbBxHX0qaJwSKWE1I/bmO7wSd5 f0mw== ARC-Authentication-Results: i=1; mx.google.com; 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 k190-20020a6384c7000000b004fb9330dcfcsi14748756pgd.323.2023.03.21.11.35.09; Tue, 21 Mar 2023 11:35:24 -0700 (PDT) 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; 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 S230017AbjCUR7j (ORCPT + 99 others); Tue, 21 Mar 2023 13:59:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjCUR7g (ORCPT ); Tue, 21 Mar 2023 13:59:36 -0400 Received: from smtp.smtpout.orange.fr (smtp-29.smtpout.orange.fr [80.12.242.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6D7B1BAC1 for ; Tue, 21 Mar 2023 10:59:34 -0700 (PDT) Received: from localhost.localdomain ([109.190.253.13]) by smtp.orange.fr with ESMTPA id egGTpZTNYNBsfegGWp5b3D; Tue, 21 Mar 2023 18:59:32 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 21 Mar 2023 18:59:32 +0100 X-ME-IP: 109.190.253.13 From: Christophe JAILLET To: harry.wentland@amd.com, sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, aurabindo.pillai@amd.com, roman.li@amd.com, hersenxs.wu@amd.com, stylon.wang@amd.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] drm/amd/display: Slightly optimize dm_dmub_outbox1_low_irq() Date: Tue, 21 Mar 2023 18:58:50 +0100 Message-Id: X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761003411284728536?= X-GMAIL-MSGID: =?utf-8?q?1761003411284728536?= A kzalloc()+memcpy() can be optimized in a single kmemdup(). This saves a few cycles because some memory doesn't need to be zeroed. Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 5bac5781a06b..57a5fbdab890 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -820,15 +820,14 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params) DRM_ERROR("Failed to allocate dmub_hpd_wrk"); return; } - dmub_hpd_wrk->dmub_notify = kzalloc(sizeof(struct dmub_notification), GFP_ATOMIC); + dmub_hpd_wrk->dmub_notify = kmemdup(¬ify, sizeof(struct dmub_notification), + GFP_ATOMIC); if (!dmub_hpd_wrk->dmub_notify) { kfree(dmub_hpd_wrk); DRM_ERROR("Failed to allocate dmub_hpd_wrk->dmub_notify"); return; } INIT_WORK(&dmub_hpd_wrk->handle_hpd_work, dm_handle_hpd_work); - if (dmub_hpd_wrk->dmub_notify) - memcpy(dmub_hpd_wrk->dmub_notify, ¬ify, sizeof(struct dmub_notification)); dmub_hpd_wrk->adev = adev; if (notify.type == DMUB_NOTIFICATION_HPD) { plink = adev->dm.dc->links[notify.link_index];