From patchwork Fri Jul 15 14:52:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 590858 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 79830C43334 for ; Fri, 15 Jul 2022 14:56:09 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 91EB61923; Fri, 15 Jul 2022 16:55:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 91EB61923 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657896967; bh=Tis0FQT0e+DRH/Zi+V3hONW0zjENY2eP93kg4/dUjnI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ALAhsQ+2S0SUk1PjxPAB650aXFuwrZTm+34vlkwg8weilhLoWTPeyBfanv4AqKkv7 kK/QwQJQBbABJyl4JvH2GyiUDoza75zKh8a9Ijjo8hF7P3KpULpBsbjbc0LEMJQvVh o2aPt/0aWUCntfCJEvU+j9nSPnmHseL4kWhYjTXw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 468C7F80587; Fri, 15 Jul 2022 16:53:15 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A5AA4F8055C; Fri, 15 Jul 2022 16:53:08 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 B0AD6F80543 for ; Fri, 15 Jul 2022 16:52:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B0AD6F80543 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="k1txNH5v" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657896778; x=1689432778; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Tis0FQT0e+DRH/Zi+V3hONW0zjENY2eP93kg4/dUjnI=; b=k1txNH5vxOOra2q77ZPF2aCbAC7IRBlkh7bBO1mNbRhA0r5POCnSi/PD 10qqLKIoF3aqRyzlOn2krBK+pH4TA2ae9qSQkQzOe3zt003Ul/VVj/UO3 cEwd3Q6u9I+7scU8Zb0fwq9VGVlH5kdb1uohW7sP4FuEeVGJwtZ1otIvw OO8rJTuSWYC+FtZ/2H6TwHM7IEId5+g+uQ7/hwmlLDHvAevUARjSGeYl2 fPFZj0s9CINC+s5d/AlmhD52zIlCQxLz1j9xasNG1/zLPDIz4ouWDtcgM WIPE4pjdYNswIFettdFFJvJjW8duP371ywT5VkhXVZ6tbvDXQBPwgOynv w==; X-IronPort-AV: E=McAfee;i="6400,9594,10408"; a="311476913" X-IronPort-AV: E=Sophos;i="5.92,274,1650956400"; d="scan'208";a="311476913" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 07:52:34 -0700 X-IronPort-AV: E=Sophos;i="5.92,274,1650956400"; d="scan'208";a="923533125" Received: from jmurope-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.14.184]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 07:52:34 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 07/11] ASoC: SOF: Intel: atom: don't keep a temporary string in fixup_tplg_name Date: Fri, 15 Jul 2022 09:52:12 -0500 Message-Id: <20220715145216.277003-8-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220715145216.277003-1-pierre-louis.bossart@linux.intel.com> References: <20220715145216.277003-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, Bard Liao , broonie@kernel.org, Peter Ujfalusi , Pierre-Louis Bossart X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi fixup_tplg_name() doesn't need to keep the string, allocated for filename - it's temporary. Inspired by similar change for hda: commit b9088535e102 ("ASoC: SOF: Intel: HDA: don't keep a temporary variable") Reviewed-by: Bard Liao Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/atom.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/sof/intel/atom.c b/sound/soc/sof/intel/atom.c index ff5900b155dc..bd9789b483b1 100644 --- a/sound/soc/sof/intel/atom.c +++ b/sound/soc/sof/intel/atom.c @@ -274,22 +274,22 @@ static const char *fixup_tplg_name(struct snd_sof_dev *sdev, const char *ssp_str) { const char *tplg_filename = NULL; - char *filename; - char *split_ext; + const char *split_ext; + char *filename, *tmp; - filename = devm_kstrdup(sdev->dev, sof_tplg_filename, GFP_KERNEL); + filename = kstrdup(sof_tplg_filename, GFP_KERNEL); if (!filename) return NULL; /* this assumes a .tplg extension */ - split_ext = strsep(&filename, "."); - if (split_ext) { + tmp = filename; + split_ext = strsep(&tmp, "."); + if (split_ext) tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, "%s-%s.tplg", split_ext, ssp_str); - if (!tplg_filename) - return NULL; - } + kfree(filename); + return tplg_filename; }