From patchwork Fri Feb 23 17:09:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 205547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp729739dyb; Fri, 23 Feb 2024 09:25:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWGu+IcrBwkx1F6hFjhg08ghRnXbjs8sV+F2IALVSawsLpzM5Yre1+PO2P+2e6I2AmIjWTYTHsiXxEbzl+ur7SJZOrJ+Q== X-Google-Smtp-Source: AGHT+IGQIYtD3gei6cqF1GtF8GiF6Rkia3squqsym4KZQYYlN+b+Fmx904XNfD8C3JnEuBXcCkEB X-Received: by 2002:a17:90a:d712:b0:299:2240:43d with SMTP id y18-20020a17090ad71200b002992240043dmr386592pju.30.1708709119447; Fri, 23 Feb 2024 09:25:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708709119; cv=pass; d=google.com; s=arc-20160816; b=nTvFDMO7SEvE7ChnNSZGK8LZooaAWCT8KLz1fsJML8CDtC+jOVdRnACdWsIqacc11V JzyKmTb6r8V4qIO5ZggNbHSNbLwExj8g+1QLEQnODIT4zl+M5utR2IcTHopnvV0FYP77 na/pAPjSoeVDHgUZSVFfNTxcShWBXmxk5LVDlrc3ATI+6R7E2f+1Va6jAsVB/IBesQd3 P7uAafc/SoTnHsA134UPKuupCBKIYDVAk7Vh4BTCYKdFppTby/bhV2/dMV2xMsAtuWsT ecAl58MgdACFt4H29mWxkWY5fxixcyMtkOArv0vXv0olTyfrV3l6cvIhoR2k3Ll8jZi0 JfHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=yqjFD2SSA0fcwHyt4UvJnhSi3JeettLpDMfFQ+pNE78=; fh=O6uvqQpBLZDo34h8/ke+xPENtlKCXNIrxrf9Oqz2MmM=; b=VhdYL/IVcoM7BnA+nkeXcc1o+Jbe/Mrp4AMc9emiZ2tyhDDwMeSc2kzzcOKg5UcVY/ DQPKqtzncU8V1GpMnV358JhVs5Gyw65wPHpIAt0ruNxqvRC6wzQHbxhIjF9FV7bpP8xv ROSslUDoLcJDu7B5ckVVVF3qnT5y2aRMvEqxjiq8uQakSSN8qaTei8C6o45+s1SSk3i2 3D6KgRBd5qwyAH+5mJgicguPjBE5WRyh56demDdV76dBovSflsoHGtv+t0+qqQKW3Jh9 8Q+97rDHjd0KEOJtbNG+fj0bCF9ZTgMEYCo3XJ+dERHxskznrkvMvQlcVFw/LwinzcRz 48sA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ZFxKjX92; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-78793-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78793-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id oj13-20020a17090b4d8d00b00299833abd37si1484210pjb.92.2024.02.23.09.25.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:25:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78793-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ZFxKjX92; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-78793-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78793-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BB414B22C88 for ; Fri, 23 Feb 2024 17:11:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E41F12CDB2; Fri, 23 Feb 2024 17:10:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="ZFxKjX92" Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E871B12B173 for ; Fri, 23 Feb 2024 17:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.26 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708708249; cv=none; b=V/n65KD4VoLGdKLdxtGEGLi661MrEhRySSMqYNlhoZQAvjIdRC9J1M4+0L6K3TtkeFy19o4VCj0xU8C/F8o+V7zt5KHh2yhjtg25PBasN4BfGHYHZg5eeQE6kUMuUtwyuULgTFM4z6Mf2GCqeRumjcsinPEi60yOYD1MsX1dFQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708708249; c=relaxed/simple; bh=y9JUzFCj5/6Y4JFU5uKrYaAMUtXH6djFg6d36YsXAVU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nPjlRCk/XmtLqn+6K6wiQDw0fQ9Kvd9Phq/3qx7hrHwHuZhEJF1EzZTKm9fJjVOkC1Ax2zXEU1Jh4sNvhfcdFQENrYXaTugQ/CsishcRjNjPSWyB4idxYdwaUCHp0Rf13UdSBrsA/Kwbsxvo0Bl4rO/dAaBYnpmLF6xJq7clBGo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=ZFxKjX92; arc=none smtp.client-ip=80.12.242.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id dZ3GrKc3YdwEKdZ3GrQYVX; Fri, 23 Feb 2024 18:09:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1708708177; bh=yqjFD2SSA0fcwHyt4UvJnhSi3JeettLpDMfFQ+pNE78=; h=From:To:Cc:Subject:Date; b=ZFxKjX92Vu7ZqQCSXP5FXEIV4ARiUZPiTmKDl8DjfrUCWc8awqrlxd1pGs1iaZD1V ndBEv+CCPhtf4lo3spUhMT0FIZxcNl1bPZzZ6KgTC/Bd9K22kU90ZiBrLJLa0Gpgit r5mpBLS6NhtRdB6oejdlo5L8Vi/byW7v0/CVVenpgBMkRWhHsB41yRVOOjEu4Igjx1 EpdofouwzhryL49+ZIBtKnONYzCCpGC6fjGpe1iqqsnZfB3F735Hw0+SgVzN8THGMB MBvpPyvaAF0KW62UBEvVrNlthJUj5YfQltxx/yG1t0IMxCSFGrMuIlxxscCGsV8qmJ mm7/FlCgFIXOQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 23 Feb 2024 18:09:37 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/i915/display: Save a few bytes of memory in intel_backlight_device_register() Date: Fri, 23 Feb 2024 18:09:28 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791711373396893054 X-GMAIL-MSGID: 1791711373396893054 'name' may still be "intel_backlight" when backlight_device_register() is called. In such a case, using kstrdup_const() saves a memory duplication when dev_set_name() is called in backlight_device_register(). Use kfree_const() accordingly. Signed-off-by: Christophe JAILLET --- Compile tested only --- drivers/gpu/drm/i915/display/intel_backlight.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c b/drivers/gpu/drm/i915/display/intel_backlight.c index 1946d7fb3c2e..9e4a9d4f1585 100644 --- a/drivers/gpu/drm/i915/display/intel_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_backlight.c @@ -949,7 +949,7 @@ int intel_backlight_device_register(struct intel_connector *connector) else props.power = FB_BLANK_POWERDOWN; - name = kstrdup("intel_backlight", GFP_KERNEL); + name = kstrdup_const("intel_backlight", GFP_KERNEL); if (!name) return -ENOMEM; @@ -963,7 +963,7 @@ int intel_backlight_device_register(struct intel_connector *connector) * compatibility. Use unique names for subsequent backlight devices as a * fallback when the default name already exists. */ - kfree(name); + kfree_const(name); name = kasprintf(GFP_KERNEL, "card%d-%s-backlight", i915->drm.primary->index, connector->base.name); if (!name) @@ -987,7 +987,7 @@ int intel_backlight_device_register(struct intel_connector *connector) connector->base.base.id, connector->base.name, name); out: - kfree(name); + kfree_const(name); return ret; }