Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1784560pxa; Thu, 20 Aug 2020 22:17:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0t0kD49RlWUhDm38/ocfWv6tPoAF4lqKRLNtohTxY6FX2ZIQUGzgrDcwll/IlDQ5gNh0G X-Received: by 2002:a17:906:cb86:: with SMTP id mf6mr685521ejb.415.1597987047902; Thu, 20 Aug 2020 22:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597987047; cv=none; d=google.com; s=arc-20160816; b=JNWTEGepYnUHKpejB7FaphRultfFfGOWOdF33CZX2dxC+kzwnKKzeq4L0BDGivsOBn L84vMoLcs2lBhV3iGJLbJpG7pmpUiqJ2EiQk3TWpMI0BthWgoaGkUbUu4fQ/b64MXypO P8s9i/3VfBYe/vhf2c/2SLIMRFROoQziueTuxfIahOQ+X75wWUOqD1S891sAyfSYSwIl GB6dsL3/8Z0qroRXfreCIBpy2iOTv+/J+c2TMtcJwL7LZ2sepaKb5gkok6UveWx246LJ XY+cIsgoiNJx3v6c8c3YP7KC/0hiZNGOeFrHzVZs0iq1lfGq4+L5j3Z6HkwPWxsuFtsq 4dsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=oJRxaBPmWLDokbfPqKBtxg0Z3ILNp9V6VlZ+7O7OXNw=; b=uvNiA7CFZDmrhPb01/Qw/J3MtyI88qwC9BLm3j04IrKtdkRuiPTgzmmWxi8fZJ7nGO Lr+a2tNEfDFtiu/yrCO9HhwDFqgTjpg/cLedXi2O5ove2iZ6odAoxLzrO/mda904g9gv WsRob3De8+03PzY4iABTrvElBbEuKJl7Ex1xMmveYR2aCsGmnyW/YDEODbao+qRBnJQO 7spwoSqe+zouEe9jPBOEm3WjdaXYo09eMosDUnke15MbHpIf0wGzGSkiqr7LPayJZ+K7 vyXKh8G1EaMgSo9Jksl3FYyl7C+LOvfKTLAqp2ulJpfid+1xiIADL0zh7KJa5vE0tI5n jB2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Mo5bnUt+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si595947edv.603.2020.08.20.22.17.04; Thu, 20 Aug 2020 22:17:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Mo5bnUt+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726243AbgHUFP5 (ORCPT + 99 others); Fri, 21 Aug 2020 01:15:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:48422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725908AbgHUFP4 (ORCPT ); Fri, 21 Aug 2020 01:15:56 -0400 Received: from localhost (unknown [122.171.38.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8EBEA2076E; Fri, 21 Aug 2020 05:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597986956; bh=BUlBuhrUIzgdlM6CsQC2icLzscNAp8yP2BfnWG3Aqh0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Mo5bnUt+zVypr40sJ4tRpLEYqC2tGxyZWbuSD7NVCAHHrUu0B03u91Jjw3uXiDADi tT5VoFQ6SH6eQZ8owXT1uaV8vpWWn2u9z9zpPpokLb7CvSVhuyE4/80RLj3Po4yB8K QpYlET/asE2ZETLdSIaIU5w0quEOM17Q9MSBbI2g= Date: Fri, 21 Aug 2020 10:45:52 +0530 From: Vinod Koul To: Pierre-Louis Bossart Cc: Bard Liao , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, rander.wang@linux.intel.com, ranjani.sridharan@linux.intel.com, hui.wang@canonical.com, sanyog.r.kale@intel.com, mengdong.lin@intel.com, bard.liao@intel.com Subject: Re: [PATCH 2/2] soundwire: fix port_ready[] dynamic allocation in mipi_disco and ASoC codecs Message-ID: <20200821051552.GK2639@vkoul-mobl> References: <20200817174727.15139-1-yung-chuan.liao@linux.intel.com> <20200817174727.15139-3-yung-chuan.liao@linux.intel.com> <20200818063659.GW2639@vkoul-mobl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18-08-20, 07:09, Pierre-Louis Bossart wrote: > > > On 8/18/20 1:36 AM, Vinod Koul wrote: > > On 18-08-20, 01:47, Bard Liao wrote: > > > From: Pierre-Louis Bossart > > > > > > The existing code allocates memory for the total number of ports. > > > This only works if the ports are contiguous, but will break if e.g. a > > > Devices uses port0, 1, and 14. The port_ready[] array would contain 3 > > > elements, which would lead to an out-of-bounds access. Conversely in > > > other cases, the wrong port index would be used leading to timeouts on > > > prepare. > > > > > > This can be fixed by allocating for the worst-case of 15 > > > ports (DP0..DP14). In addition since the number is now fixed, we can > > > use an array instead of a dynamic allocation. > > > > > > Signed-off-by: Pierre-Louis Bossart > > > Reviewed-by: Rander Wang > > > Reviewed-by: Guennadi Liakhovetski > > > Signed-off-by: Bard Liao > > > --- > > > drivers/soundwire/mipi_disco.c | 18 +----------------- > > > drivers/soundwire/slave.c | 4 ++++ > > > include/linux/soundwire/sdw.h | 2 +- > > > sound/soc/codecs/max98373-sdw.c | 15 +-------------- > > > sound/soc/codecs/rt1308-sdw.c | 14 +------------- > > > sound/soc/codecs/rt5682-sdw.c | 15 +-------------- > > > sound/soc/codecs/rt700-sdw.c | 15 +-------------- > > > sound/soc/codecs/rt711-sdw.c | 15 +-------------- > > > sound/soc/codecs/rt715-sdw.c | 33 +-------------------------------- > > > > This looks fine, but the asoc changes are not dependent, so maybe we > > should split them up and then can go thru Mark. Or Mark acks, either way > > would work for me > > There are 3 dependencies that we tracked between SoundWire and ASoC > subsystems: > > a) addition of SDCA control macro (needed before SDCA codec drivers can be > shared) > b) this series - we could indeed submit the codec changes to Mark's tree > separately, but then the SoundWire tree would be broken: the codec drivers > would still try to allocate dynamically what is now a fixed-size array. > c) configuration of the interrupt masks in codec drivers instead of > hard-coded in bus driver + spurious parity error workaround (not posted yet > but ready). > > The changes in ASoC codecs are really only on the initialization part > (either removing a dynamic allocation or setting masks), there's no > functional change otherwise. > > I think the simplest to avoid multiple back-and-forth is to have these small > interface/initialization changes merged through the SoundWire subsystem, > then merged by Mark from a single immutable tag. Would this work for > everyone? That would work for me, but you need to split the asoc, regmap, sdw patches. I am sure looking at patch tag, other maintainers would have skipped these patches.. > In addition, there's a WIP change to regmap to add support for SoundWire 1.2 > MBQ-based register access, but this only affects regmap and ASoC trees, all > handled by Mark. > > I don't think we have any other cross-tree changes planned for now, the SDCA > infrastructure plumbing is still rather open. -- ~Vinod