From patchwork Fri Jul 28 22:30:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 9869607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C54C60382 for ; Fri, 28 Jul 2017 22:32:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12B8328905 for ; Fri, 28 Jul 2017 22:32:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07A9828925; Fri, 28 Jul 2017 22:32:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86F6D2890C for ; Fri, 28 Jul 2017 22:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753354AbdG1WbR (ORCPT ); Fri, 28 Jul 2017 18:31:17 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:44503 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753076AbdG1WbO (ORCPT ); Fri, 28 Jul 2017 18:31:14 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v6SMUEDH024166; Fri, 28 Jul 2017 17:30:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1501281014; bh=5jojF2JqZkeB7B5ifDNIbOhH5Gzr4i3Mso+nRSzu39k=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gvvYgZk8UFnvPvALLe5bGoQjNUg/scSIkRj2gypffUyTuT5o3ymC52Hal744BxUfR 2yATLl4yTT6dUp0vv6CZLCfL3vIa2KeJoWDd6hHjE/+yMPFXVFCehWaWdTooPaliBN 6ipW/ip8pkFNe4imC7h2blfXs4x+uyGEsNJTl3cU= Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v6SMU80c002048; Fri, 28 Jul 2017 17:30:08 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Fri, 28 Jul 2017 17:30:07 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v6SMU7Z1004250; Fri, 28 Jul 2017 17:30:07 -0500 Received: from localhost (uda0226610.dhcp.ti.com [128.247.59.147]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v6SMU7308950; Fri, 28 Jul 2017 17:30:07 -0500 (CDT) From: Grygorii Strashko To: "David S. Miller" , , Richard Cochran CC: Sekhar Nori , , , Wingman Kwok , Ivan Khoronzhuk , John Stultz , Thomas Gleixner , Grygorii Strashko Subject: [PATCH v4 4/4] net: ethernet: ti: cpts: fix fifo read in cpts_find_ts Date: Fri, 28 Jul 2017 17:30:05 -0500 Message-ID: <20170728223005.21420-5-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20170728223005.21420-1-grygorii.strashko@ti.com> References: <20170728223005.21420-1-grygorii.strashko@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now the call chain cpts_find_ts() |- cpts_fifo_read(cpts, CPTS_EV_PUSH) will stop reading CPTS FIFO if PUSH event is found. But this is not expected and CPTS FIFI should be completely drained here. This is most probably copy-paste error and it has no negative impact as CPTS_EV_PUSH should not be present in FIFO without TS_PUSH request and cpts_systim_read() and cpts_find_ts() synchronized by spin_lock. Correct above by calling cpts_fifo_read() with -1 parameter, so it will read all CPTS event from FIFO. Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index 95a0076..c2121d2 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -364,7 +364,7 @@ static u64 cpts_find_ts(struct cpts *cpts, struct sk_buff *skb, int ev_type) return 0; spin_lock_irqsave(&cpts->lock, flags); - cpts_fifo_read(cpts, CPTS_EV_PUSH); + cpts_fifo_read(cpts, -1); list_for_each_safe(this, next, &cpts->events) { event = list_entry(this, struct cpts_event, list); if (event_expired(event)) {