From patchwork Tue May 3 17:34:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 67081 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp719209qge; Tue, 3 May 2016 10:35:24 -0700 (PDT) X-Received: by 10.98.20.131 with SMTP id 125mr5423485pfu.166.1462296918150; Tue, 03 May 2016 10:35:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si243457paw.142.2016.05.03.10.35.17; Tue, 03 May 2016 10:35:18 -0700 (PDT) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965024AbcECRe7 (ORCPT + 29 others); Tue, 3 May 2016 13:34:59 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:32781 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965003AbcECRez (ORCPT ); Tue, 3 May 2016 13:34:55 -0400 Received: by mail-io0-f177.google.com with SMTP id f89so29783120ioi.0 for ; Tue, 03 May 2016 10:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AjSPfJYNL88ufCKnWaoWU3uD8BgLh0Th0bvhbYcA0sI=; b=NLwwTCzAg39mOsLkHW7m88ftxKBxDF11WNwlpvikDDVImIGnUvuL64++UFE7LXQcIg nu322ruW4VpmqLpmr6+G+dQPH0Gcz0sCNy6FGFWy1gqI7X2Ydzu4aTVzExUOD1I/21uS iJPIezDmm5F79tCcojvqGLbcjlM1nl47uAgPI= 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:in-reply-to :references; bh=AjSPfJYNL88ufCKnWaoWU3uD8BgLh0Th0bvhbYcA0sI=; b=jK+a6/nvcCGSlR47pOaEoIk5NXNFu6cUxL2Nu/k2JZzJwnB2Dxta6KVy+5ZMPPu2fh zpDVGQXl+UzzvLVMjqxVx3s8r765uqXF2vw1oKTrG8H6YPEILhLw5i+5xNCJs1ZswyFO 6zPlQ63wnNZ2VjYaAnKAl9nPARVO8AMAyk5ByeGZb9OOdo9w4M8YZ9/AgjAQ0XbNZl1+ AeSxq6S/Ncx4vQhbnD92Np5dnmmr52xNiQ6JPvoOZWsPz8CkzMqxlAdphRLmpgyZewG7 kOOPmnuaHoQHBmq7wz5v79cO5jQdisqz/kNyTpfNmyXqzWd/gzJrIEC4PRGbmKc0jJ8F SOSQ== X-Gm-Message-State: AOPr4FUNYbMN2uYh2h/AJkFQnwGlf3yUTV27vQLf9BzS3m0nLtLuXvjsZgBBXsRt4DihrkXZ X-Received: by 10.107.56.198 with SMTP id f189mr4871189ioa.156.1462296894061; Tue, 03 May 2016 10:34:54 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k33sm103957iod.44.2016.05.03.10.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 May 2016 10:34:52 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 27/27] coresight: etb10: adjust read pointer only when needed Date: Tue, 3 May 2016 11:34:01 -0600 Message-Id: <1462296841-12327-28-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1462296841-12327-1-git-send-email-mathieu.poirier@linaro.org> References: <1462296841-12327-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The read pointer (read_ptr) needs to be adjusted only if its value has gone beyond the length of the memory buffer. Reported-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.5.0 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 92f942321e1e..4d20b0be0c0b 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -428,7 +428,8 @@ static void etb_update_buffer(struct coresight_device *csdev, read_ptr = (write_ptr + drvdata->buffer_depth) - to_read / ETB_FRAME_SIZE_WORDS; /* Wrap around if need be*/ - read_ptr &= ~(drvdata->buffer_depth - 1); + if (read_ptr > (drvdata->buffer_depth - 1)) + read_ptr -= drvdata->buffer_depth; /* let the decoder know we've skipped ahead */ local_inc(&buf->lost); }