From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932115AbdJWLOw (ORCPT ); Mon, 23 Oct 2017 07:14:52 -0400 Received: from mga05.intel.com ([192.55.52.43]:29845 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751363AbdJWLOv (ORCPT ); Mon, 23 Oct 2017 07:14:51 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,422,1503385200"; d="scan'208";a="326515570" Date: Mon, 23 Oct 2017 16:49:11 +0530 From: Vinod Koul To: Mark Brown Cc: Greg Kroah-Hartman , LKML , ALSA , Takashi , Pierre , Sanyog Kale , Shreyas NC , patches.audio@intel.com, alan@linux.intel.com, Charles Keepax , Sagar Dharia , srinivas.kandagatla@linaro.org, plai@codeaurora.org, Sudheer Papothi Subject: Re: [PATCH 03/14] soundwire: Add Master registration Message-ID: <20171023111910.GG936@localhost> References: <1508382211-3154-1-git-send-email-vinod.koul@intel.com> <1508382211-3154-4-git-send-email-vinod.koul@intel.com> <20171021091230.pwevgreloynqe7nu@sirena.org.uk> <20171021113513.GF30097@localhost> <20171023082426.77tcpq4wtd4cwi7i@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171023082426.77tcpq4wtd4cwi7i@sirena.org.uk> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 23, 2017 at 09:24:26AM +0100, Mark Brown wrote: > On Sat, Oct 21, 2017 at 05:05:13PM +0530, Vinod Koul wrote: > > On Sat, Oct 21, 2017 at 10:12:30AM +0100, Mark Brown wrote: > > > On Thu, Oct 19, 2017 at 08:33:19AM +0530, Vinod Koul wrote: > > > > > + mutex_lock(&bus->bus_lock); > > > > + if (!list_empty(&bus->slaves)) > > > > + list_del(&slave->node); > > > > Shouldn't that be a while? Or at least warn if there's anything extra > > > there. The code just looks very wrong as is. > > > I think you missed that it is called from sdw_delete_bus_master() which does > > the loop by invoking device_for_each_child(), so this ones is supposed to > > ensure one Slave is removed cleaned. > > > Let me know if i misread your comment. > > My point is that this code just looks so obviously wrong it doesn't > matter if it actually works, we should refactor so people don't look at > the code and immediately think they've spotted a bug. Okay will check and try to refactor this part. -- ~Vinod