Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754940AbbLKKtH (ORCPT ); Fri, 11 Dec 2015 05:49:07 -0500 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33506 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751271AbbLKKtE (ORCPT ); Fri, 11 Dec 2015 05:49:04 -0500 From: Chunyan Zhang To: alexander.shishkin@linux.intel.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] stm: the number of masters should be (sw_end - sw_start + 1) Date: Fri, 11 Dec 2015 18:47:59 +0800 Message-Id: <1449830880-15319-2-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449830880-15319-1-git-send-email-zhang.chunyan@linaro.org> References: <1449830880-15319-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1102 Lines: 30 sw_end represents the last software master, sw_start is index of the first master, so the number of software masters should be sw_end - sw_start + 1. Signed-off-by: Chunyan Zhang --- drivers/hwtracing/stm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index 7f7bdb3..cb676f2 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -632,7 +632,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data, if (!stm_data->packet || !stm_data->sw_nchannels) return -EINVAL; - nmasters = stm_data->sw_end - stm_data->sw_start; + nmasters = stm_data->sw_end - stm_data->sw_start + 1; stm = kzalloc(sizeof(*stm) + nmasters * sizeof(void *), GFP_KERNEL); if (!stm) return -ENOMEM; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/