From patchwork Wed Aug 3 04:42:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 9260753 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 729E66048F for ; Wed, 3 Aug 2016 04:42:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62E852848E for ; Wed, 3 Aug 2016 04:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 579892854D; Wed, 3 Aug 2016 04:42:37 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFF9E2848E for ; Wed, 3 Aug 2016 04:42:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F8C36E0D8; Wed, 3 Aug 2016 04:42:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTP id AFF4F6E3D9 for ; Wed, 3 Aug 2016 04:42:30 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 02 Aug 2016 21:42:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,464,1464678000"; d="scan'208"; a="1028767754" Received: from rdvivi-hillsboro.jf.intel.com ([10.7.196.156]) by orsmga002.jf.intel.com with ESMTP; 02 Aug 2016 21:42:18 -0700 From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Date: Tue, 2 Aug 2016 21:42:07 -0700 Message-Id: <1470199327-5833-2-git-send-email-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1470199327-5833-1-git-send-email-rodrigo.vivi@intel.com> References: <1470199327-5833-1-git-send-email-rodrigo.vivi@intel.com> Cc: Rodrigo Vivi Subject: [Intel-gfx] [PATCH 2/2] drm/i915: Fix the return value of pipe crc read function. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP A read(fd, buf, len) function should return the number of bytes read. In our case we need to return the number of bytes we copy to user, instead of returning the number of bytes we read internally. It was really strange when I saw i-g-t test case using len '54' but getting '56' as return. First thought was how do we read more than we asked? But also I checked and there was really only 54. Until I realized it was all our fault. EFAULT! Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 7052c47..b7b8d79 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -3659,7 +3659,7 @@ i915_pipe_crc_read(struct file *filep, char __user *user_buf, size_t count, spin_unlock_irq(&pipe_crc->lock); - return bytes_read; + return PIPE_CRC_LINE_LEN; } static const struct file_operations i915_pipe_crc_fops = {