Received: by 10.213.65.68 with SMTP id h4csp527075imn; Fri, 16 Mar 2018 10:26:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELvfaNEbLRiGxHKYY4TKYF82G/kLYfw42UHiqb4A018MZz4KUDO8f0Fu+RHXfzNDREvFFeYp X-Received: by 10.101.98.90 with SMTP id q26mr2104977pgv.113.1521221179338; Fri, 16 Mar 2018 10:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521221179; cv=none; d=google.com; s=arc-20160816; b=E7TQMhNPvvWDNEPKbW0VDTjYC8vdiixmjq7m2Ek4srt9Pitmt3s1JCWcAHbtJW+iRJ brcXl/oEukYXF/s5X9llo6Ncs43+pN27tPzVMCsN/vD3pTAUek4ILDMnS23eCY3aiUVl 2of3viLqxtpTQjNdG/6irD0b7kXjOtg3i0uj7GJflEO08ZhcWJFi9YdbS0Sd/PL2wvaT JcyG467obdxBYn1xs5yQIHfbtkjpbrSP4LGujki9hzFWgnmAuLhJNO4LxgfcpgnXo1QH Y31CdAleBBnfYlVuyTugm8804yhjD3LgmylEBD1p1kwLrpdzYPVIJXINdAoyngxz8i1t 8Wxw== 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=Lf4zu0l7yxgQWGPAI+P8c3D+ekGl09YxXJUYKSlDNH4=; b=vrBbBQ3XRqfM2FuH9p9x6GNBrVgsrBdY8I6lqUGrpTcCSqcfppSMmSHFw+/hR1nmwP Gifd/yFmMIwj74M0233jVWSJnL5x0mhXwtVnZlntKmO9rqa+uEW0NqhOo8zD/SD09Nz4 9xONFXSyCKeelfxvhesuuU58dzjlUgx4FirOMj6ahhWhq5+2xVSwqTYwuE8vd8PLNX3v M4fLaNf3gpfqeSmVuYSYYs0DT0QIV2exbfjkYredImN0Zrt7+S29xE25lKwUcNAfsJ8E Oc1qxQrLpMrbjrY9owaI6cecTe4cgtLsrI/T4Mw5lWFE3fvHRshDNvMZrw0iSGNS/Vlk J7/A== 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 d8-v6si3387326pli.332.2018.03.16.10.26.04; Fri, 16 Mar 2018 10:26:19 -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 S932974AbeCPP3G (ORCPT + 99 others); Fri, 16 Mar 2018 11:29:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35990 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754264AbeCPP3A (ORCPT ); Fri, 16 Mar 2018 11:29:00 -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 3E28AC8A; Fri, 16 Mar 2018 15:29:00 +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.4 55/63] staging: comedi: fix comedi_nsamples_left. Date: Fri, 16 Mar 2018 16:23:27 +0100 Message-Id: <20180316152305.984404523@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152259.964532775@linuxfoundation.org> References: <20180316152259.964532775@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.4-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;