Received: by 10.213.65.68 with SMTP id h4csp512051imn; Fri, 16 Mar 2018 10:01:09 -0700 (PDT) X-Google-Smtp-Source: AG47ELu5yBMIcUv/1FGpjxjbFLFYkARCxuaFKoAs985Ct2ugaD17tHorFvK7hDqGc35n2mnIuvVp X-Received: by 10.99.145.193 with SMTP id l184mr1964238pge.394.1521219669602; Fri, 16 Mar 2018 10:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521219669; cv=none; d=google.com; s=arc-20160816; b=m6rQIaaSXWHk6vcPkUBKi8eQGkZvUwgTtXi3XP+SuJVoKhJVY8/asR794dZ6WLE4Ds iPptryZhv1BTF95C+OXmPKWPIpP6+Ov1z1aQ76J2DA5f0WrFkT4KRDgAdlz1XkzRZ4d0 AWJx3RNVRZS/p/0J6/A0WjDoU+1xXAnCNh83pHlRDgFd2Onye6V3MTEcyoJGnmoLvQdk 17ANCFyganE4iZd+PtW/UxHmYIdm/Rz1doMDqmKkVu2bzfBYhXX0XXB8wowMv3PxrI1v yVtqjxoNuV268x9FQnvng5xeqVYacRrm+8AZNnzPc/hxJy1OYAZOVE3GAlA7Eo6p17XK Ng/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ddyo13hB3K9pjG2sD2/9NSnF6+jGK0buYnehZQ17CsU=; b=tutxNulA8+ayObrf2BdugTItA2F2yGXpoyhq5CUCph8lTVqx3j0ZUrbsJ4UnCgg456 EmX+qOGtXIBIQXHcWfwuoM4b0ifnhDBMJ2TWwBwkqctmrtdjPVQ+W1grP0Duv0KlnN+s 6ZQPbK9NaeSRIqJzOELcTT/RevR+dxcHgPN1Ac4z5sxxU8fYWya76MMDk5AJCY2ZFclA LAJ/owWPasTKsjqpoIENgKKtPNzTJxKczKIAOtFEmW6alrs2GNKKmWf46t8H5/tVu463 AcqGaKAfpmg75P5IfsKjxwxIX2Rj+aeA+z5aMpehedlYH2vBmqaUXIjcOS6UT5Gso2IZ BxXg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5-v6si6622251plf.223.2018.03.16.10.00.54; Fri, 16 Mar 2018 10:01:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753320AbeCPQ6a (ORCPT + 99 others); Fri, 16 Mar 2018 12:58:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38326 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933707AbeCPPdM (ORCPT ); Fri, 16 Mar 2018 11:33:12 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B983F123C; Fri, 16 Mar 2018 15:33:11 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Mori Hess , Ian Abbott Subject: [PATCH 4.9 76/86] staging: comedi: fix comedi_nsamples_left. Date: Fri, 16 Mar 2018 16:23:39 +0100 Message-Id: <20180316152322.466885794@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152317.167709497@linuxfoundation.org> References: <20180316152317.167709497@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Frank Mori Hess commit a42ae5905140c324362fe5036ae1dbb16e4d359c upstream. A rounding error was causing comedi_nsamples_left to return the wrong value when nsamples was not a multiple of the scan length. Cc: # v4.4+ Signed-off-by: Frank Mori Hess Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -484,8 +484,7 @@ unsigned int comedi_nsamples_left(struct struct comedi_cmd *cmd = &async->cmd; if (cmd->stop_src == TRIG_COUNT) { - unsigned int nscans = nsamples / cmd->scan_end_arg; - unsigned int scans_left = __comedi_nscans_left(s, nscans); + unsigned int scans_left = __comedi_nscans_left(s, cmd->stop_arg); unsigned int scan_pos = comedi_bytes_to_samples(s, async->scan_progress); unsigned long long samples_left = 0;