From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756639AbcBIKM2 (ORCPT ); Tue, 9 Feb 2016 05:12:28 -0500 Received: from mga01.intel.com ([192.55.52.88]:57209 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756430AbcBIKM0 (ORCPT ); Tue, 9 Feb 2016 05:12:26 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,420,1449561600"; d="scan'208";a="649460643" From: Alexander Shishkin To: Chunyan Zhang Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, zhang.lyra@gmail.com Subject: Re: [PATCH] drivers: stm: correct the index in master array release In-Reply-To: <1453954889-6290-1-git-send-email-zhang.chunyan@linaro.org> References: <1453954889-6290-1-git-send-email-zhang.chunyan@linaro.org> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Tue, 09 Feb 2016 12:12:23 +0200 Message-ID: <87pow6chvc.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: > 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. Regards, -- Alex