From patchwork Wed Apr 3 09:31:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 785447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D20ADCD1288 for ; Wed, 3 Apr 2024 09:33:08 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3F2142C66; Wed, 3 Apr 2024 11:32:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3F2142C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1712136787; bh=Uf61lRVj55WHImUiBlCNQuyLIKLzrbNeeTxDN7YZoBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=sZflJNcuuArVjLU+TSiZWh1GAf3BqdS5QKX/BFDDDgqwCJBLPOpgZtapxHepjBS3p e8Igg+S4/QjNY2O88LkLMPhgcMdxT31pT0e3z1iUnPF8bhTXZ6lPcLrzQkTUGRLDP0 4Gy8rnU9opRtjbCPbGxY4T4SL3L9fIbDzu5intmg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 85621F8064C; Wed, 3 Apr 2024 11:31:41 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C3C44F80659; Wed, 3 Apr 2024 11:31:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DE6C7F805B2; Wed, 3 Apr 2024 11:31:30 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E3096F8020D for ; Wed, 3 Apr 2024 11:31:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E3096F8020D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NjvORwxD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712136679; x=1743672679; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Uf61lRVj55WHImUiBlCNQuyLIKLzrbNeeTxDN7YZoBI=; b=NjvORwxDO2IjfRSPF3jWTqknNW2QdIpctKgokz6vIdRTq2uuXTSZXbYi vDmVRf2LZqL1wJU3l5877ZF7g59gmci8yVGJzR7mPCBbgEvMlLefTYLLU kW4heFlxF6RCOu/py6glLa0J7QlMTe80KEfGCbdQCdEs+h1HkgWMBoJmO 2o7hOLy6niI2/8lblGqOt2/r2xdl0hmpeIGYZ3p1F+aRtX6Ox8EQ3KJGR OdgqptGBfk5y2GEl1h4GVV0QPtiZr7Pc7KoRWL6F00lJrKcom09iMeAw8 XZsvFNnqRi1xwof8fyw7GizYlDQW+QhXOfTwlAZZRUd/u7sQytbkEGGez w==; X-CSE-ConnectionGUID: jTFmdanRTWuik2YLU+gzPw== X-CSE-MsgGUID: 4GnvQMn2SaubWgGTt/WdnA== X-IronPort-AV: E=McAfee;i="6600,9927,11032"; a="7218683" X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="7218683" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2024 02:31:17 -0700 X-CSE-ConnectionGUID: k/r99CPlRYqUchUEr9fhxQ== X-CSE-MsgGUID: XpQjvu2fTWScFgk96aZwEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="18797538" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orviesa007.jf.intel.com with ESMTP; 03 Apr 2024 02:31:15 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, =?utf-8?q?Amadeus?= =?utf-8?q?z_S=C5=82awi=C5=84ski?= Subject: [PATCH 02/10] ASoC: Intel: avs: Use devm_kstrdup_const Date: Wed, 3 Apr 2024 11:31:37 +0200 Message-Id: <20240403093145.3375857-3-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240403093145.3375857-1-amadeuszx.slawinski@linux.intel.com> References: <20240403093145.3375857-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: JKMKKXLZVL75C4OQRPG6JVO4UPE7BYCF X-Message-ID-Hash: JKMKKXLZVL75C4OQRPG6JVO4UPE7BYCF X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: FW name is constant and we just duplicate it, use const variant of devm_kstrdup to possibly save a bit of memory. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/avs.h | 2 +- sound/soc/intel/avs/utils.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h index f80f79415344a..9a02e2b528bc5 100644 --- a/sound/soc/intel/avs/avs.h +++ b/sound/soc/intel/avs/avs.h @@ -107,7 +107,7 @@ struct avs_spec { }; struct avs_fw_entry { - char *name; + const char *name; const struct firmware *fw; struct list_head node; diff --git a/sound/soc/intel/avs/utils.c b/sound/soc/intel/avs/utils.c index 82416b86662d8..8100c2fa0a7ed 100644 --- a/sound/soc/intel/avs/utils.c +++ b/sound/soc/intel/avs/utils.c @@ -250,7 +250,7 @@ int avs_request_firmware(struct avs_dev *adev, const struct firmware **fw_p, con if (!entry) return -ENOMEM; - entry->name = kstrdup(name, GFP_KERNEL); + entry->name = kstrdup_const(name, GFP_KERNEL); if (!entry->name) { kfree(entry); return -ENOMEM; @@ -258,7 +258,7 @@ int avs_request_firmware(struct avs_dev *adev, const struct firmware **fw_p, con ret = request_firmware(&entry->fw, name, adev->dev); if (ret < 0) { - kfree(entry->name); + kfree_const(entry->name); kfree(entry); return ret; } @@ -282,7 +282,7 @@ void avs_release_last_firmware(struct avs_dev *adev) list_del(&entry->node); release_firmware(entry->fw); - kfree(entry->name); + kfree_const(entry->name); kfree(entry); } @@ -296,7 +296,7 @@ void avs_release_firmwares(struct avs_dev *adev) list_for_each_entry_safe(entry, tmp, &adev->fw_list, node) { list_del(&entry->node); release_firmware(entry->fw); - kfree(entry->name); + kfree_const(entry->name); kfree(entry); } }