From mboxrd@z Thu Jan 1 00:00:00 1970 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 2DED0C433EF for ; Mon, 7 Mar 2022 16:43:06 +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 05A5E16FB; Mon, 7 Mar 2022 17:42:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 05A5E16FB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646671385; bh=aPGSMPziAk1c8hWpejh68nVliOMBmz/9pDN4t02K0Qc=; h=Subject:From:To:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WprQzonYo0DC1KzZHwfCq0TU6eVlSftyKrGSwMblKQZJBwhTM1b/4nhfUBwP+gzCa hgKKSn16aWwWu7l/Q9/MsOr48Ppihn6XLeN9leR/oYfFehFYJBJvCKqwRfjmhfCQ+s yCHgA4K5HP5suEh5aA6hbimP12Umdsj5o2mEngaI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A06DAF80132; Mon, 7 Mar 2022 17:42:14 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4CD6BF8013F; Mon, 7 Mar 2022 17:42:13 +0100 (CET) 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 8E6B1F80124 for ; Mon, 7 Mar 2022 17:42:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8E6B1F80124 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PUdXd3wu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646671331; x=1678207331; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=aPGSMPziAk1c8hWpejh68nVliOMBmz/9pDN4t02K0Qc=; b=PUdXd3wuzKWS8x5qBHMamjXb2oF975FWoK6dGVbAPx4kNuWZTFTgLydu yD1bVKJGGtw/M5H+/PzI4MQBT5+8TbN2lV3jGJRHPO08JnObF36snlAXr RH0oO1pB2LijjgaPRc5fL3r5P007ic5TidWHRg19y0o6Ir6uwwVDyk+X9 0iBtYTG1lkYwsOXQTxzrYWSigxgroJiOrwflMC+V42gXgyuJxxSz2EN87 mx0ZwYbwui6+t0t1yCruVSMLcFO++4DYeltrbW/0k9FoHcY1E4kaVaX5q xCyC03+ylKwOr4gbSr1ALZgbX40+04D6p1TexUCUGUrWpmKZLZwNXA92j Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="279145399" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="279145399" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 08:41:56 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="546947595" Received: from zhaojohn-mobl1.amr.corp.intel.com ([10.254.24.100]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 08:41:55 -0800 Message-ID: <75e4e6e483a90057831fa8b9ab3ece6ef5cc2f12.camel@linux.intel.com> Subject: Re: [PATCH v3 10/17] ASoC: Intel: avs: Add basefw runtime-parameter requests From: Ranjani Sridharan To: Cezary Rojewski , alsa-devel@alsa-project.org Date: Mon, 07 Mar 2022 08:41:55 -0800 In-Reply-To: References: <20220304145755.2844173-1-cezary.rojewski@intel.com> <20220304145755.2844173-11-cezary.rojewski@intel.com> <2bc36351e4c14bd4b3d55f26eec2cda1b77e7728.camel@linux.intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Cc: upstream@semihalf.com, harshapriya.n@intel.com, rad@semihalf.com, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, broonie@kernel.org, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, lma@semihalf.com 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" > > > + kfree(payload); > > I think it would be easier to understand this kfree if payload was > > also > > allocated in this function in stead of inside the > > get_large_config(). > > That's a good thinking. There was an internal conversation regarding > this back in time when we have been implementing getters for the > first > time. There are no clear victors, there are drawbacks - as you do > not > know the size upfront, caller has to guess and then reallocate the > buffer accordingly to retrieved payload size from the firmware. So, > even > if you allocate buffer here, chances are, it's not the same buffer > when > the avs_ipc_get_large_config() returns to the caller. > > We have decided to reduce the code size by letting the single, > common > handler do the allocation and leave the other responsibilities to > the > caller. What could make it simpler is if you allocate MAX IPC size for payload in this function and then copy the right size in the avs_ipc_get_large_config(). payload_size tells you that information anyway right? Thanks, Ranjani