From patchwork Thu Jan 28 04:21:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 60673 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp243175lbb; Wed, 27 Jan 2016 20:22:53 -0800 (PST) X-Received: by 10.66.121.136 with SMTP id lk8mr1458946pab.1.1453954973140; Wed, 27 Jan 2016 20:22:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w17si13988796pfi.241.2016.01.27.20.22.52; Wed, 27 Jan 2016 20:22:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968409AbcA1EWF (ORCPT + 30 others); Wed, 27 Jan 2016 23:22:05 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:33326 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934609AbcA1EVx (ORCPT ); Wed, 27 Jan 2016 23:21:53 -0500 Received: by mail-pf0-f175.google.com with SMTP id x125so16669348pfb.0 for ; Wed, 27 Jan 2016 20:21:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=AO7CEiW8gqrCNyoL+Nr0xRaHwUiruOhU2/iNnfMcQMU=; b=APYuplD6jtT0JONrTjiLZTrlpFc2fQOXd/5QAJ+IrIOv5h9doWBh/720qxdxpYRT+U mvf8KKjrY2CYBBrVsrwAqHcKWtXnOfNLkxh1/uasOKiRxNRyX6EXGgpUiE66T+rVBI0j Zqv+x9kqEdCLvH5Qb3fDCblIrOebmojD0jrmQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AO7CEiW8gqrCNyoL+Nr0xRaHwUiruOhU2/iNnfMcQMU=; b=XcpDp/iJ5ILy+k5tn2whS8hjTu2Q9cCpwg0geSHUCfuQl3RsFLlv4Gs8DmFV8XYPEr W42X3CBLFfzWmZIOh2O009+hvrbXBXjFnv367RaKQcTi414Zefoev62IymythRjELGLS UUNl9bjPR+PyUiHAU4WwvwWH76oOsrBHRa6MsCRcRpOWnBbYiGeE/GkmJUFrSJLG5hNj OyN+IKTGCCqfhiYv6PEUOqYKQulr9rhQZMHP5eGjvEmufLfOdwpd+ejHdpFbZl4Xxh5r WEOP9dgqOrgiY4VaSvjoSA5LK8OOeallb4u2sGtTxOIZBrFk6gYteLDLKsQj7xFBv8zH Jrmw== X-Gm-Message-State: AG10YOQCiH06jI5C0igdgNpFZufVjkpjMWgwftuDsX5fQsARxyOLMuUqAqncogFzJLm39qHX X-Received: by 10.98.66.77 with SMTP id p74mr1440356pfa.43.1453954913183; Wed, 27 Jan 2016 20:21:53 -0800 (PST) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id fc8sm12349247pab.21.2016.01.27.20.21.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Jan 2016 20:21:52 -0800 (PST) From: Chunyan Zhang To: alexander.shishkin@linux.intel.com Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, zhang.lyra@gmail.com Subject: [PATCH] drivers: stm: correct the index in master array release Date: Thu, 28 Jan 2016 12:21:29 +0800 Message-Id: <1453954889-6290-1-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Chunyan Zhang --- drivers/hwtracing/stm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index da53b5d..80e7b5e 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -718,7 +718,7 @@ void stm_unregister_device(struct stm_data *stm_data) stp_policy_unbind(stm->policy); mutex_unlock(&stm->policy_mutex); - for (i = 0; i < stm->sw_nmasters; i++) + for (i = stm->data->sw_start; i <= stm->data->sw_end; i++) stp_master_free(stm, i); device_unregister(&stm->dev);