From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753092AbcBOKeP (ORCPT ); Mon, 15 Feb 2016 05:34:15 -0500 Received: from mga14.intel.com ([192.55.52.115]:22057 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753070AbcBOKeN (ORCPT ); Mon, 15 Feb 2016 05:34:13 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,449,1449561600"; d="scan'208";a="885158916" From: Alexander Shishkin To: Chunyan Zhang Cc: "linux-kernel\@vger.kernel.org" , Mathieu Poirier , Lyra Zhang Subject: Re: [PATCH] drivers: stm: correct the index in master array release In-Reply-To: References: <1453954889-6290-1-git-send-email-zhang.chunyan@linaro.org> <87pow6chvc.fsf@ashishki-desk.ger.corp.intel.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 15 Feb 2016 12:34:10 +0200 Message-ID: <87bn7iclel.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Chunyan Zhang writes: > On Tue, Feb 9, 2016 at 6:12 PM, Alexander Shishkin > wrote: >> Chunyan Zhang writes: >> >>> It would be broken if stm_data->sw_start isn't zero, because that >>> stp_master_free() get the 'master' with __stm_master()/stm_master(), >>> in which the masterID is the second input parameter minus >>> stm_data->sw_start. So freeing STM masters has to start from >>> stm_data->sw_start. >> >> No, it won't. stm_master_free() handles nonexistent masters correctly. >> It does make sense to shrink the loop in stm_unregister_device() to >> avoid going through the [0..sw_start) range, since stm_master() returns >> NULL for those, but not for the reasons given in this patch description. > > Let's assume sw_start = 64, sw_end = 79, sw_nmasters should be 16, if > the loop goes through [0..16), the existed masters will not be freed. Ah yes, you're right, of course. I'll add this fix to the queue with a proper description. Thanks, -- Alex