From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp107.iad3b.emailsrvr.com ([146.20.161.107]:47160 "EHLO smtp107.iad3b.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728667AbeKLVyq (ORCPT ); Mon, 12 Nov 2018 16:54:46 -0500 Subject: Re: [PATCH stable 3.9 to 3.16] staging: comedi: quatech_daqp_cs: fix no-op loop daqp_ao_insn_write() To: Ben Hutchings , stable@vger.kernel.org Cc: Greg Kroah-Hartman , Dan Carpenter , H Hartley Sweeten References: <20180710170226.23969-1-abbotti@mev.co.uk> From: Ian Abbott Message-ID: <7f067209-86a6-e063-390e-f2d2ff0b1fca@mev.co.uk> Date: Mon, 12 Nov 2018 11:56:09 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 09/11/18 23:44, Ben Hutchings wrote: > On Tue, 2018-07-10 at 18:02 +0100, Ian Abbott wrote: >> From: Dan Carpenter >> >> [ Upstream commit 1376b0a2160319125c3a2822e8c09bd283cd8141 ] >> >> There is a '>' vs '<' typo so this loop is a no-op. > > Thanks, but this driver seems to have lots of other bugs in 3.16, like > it only ever accesses data[0] in this loop. I don't think there's much > point in applying just this one. But if you think it's worth fixing > then I can apply all the necessary fixes. > > Ben. It restores some basic functionality for daqp_ao_insn_write() that was broken. The most common case to be handled is insn->n == 1, as that is what the comedi_data_write() function in the user-space Comedilib library sets. However, it may be worth applying e024181b02ed ("staging: comedi: quatech_daqp_cs: fix bug in daqp_ao_insn_write()") and (with a small amount of backporting) e031642eccc0 ("staging: comedi: quatech_daqp_cs: use comedi_timeout() in ao (*insn_write)") before this one. I'll append a patch series as replies to this email. > >> Fixes: d35dcc89fc93 ("staging: comedi: quatech_daqp_cs: fix daqp_ao_insn_write()") >> Signed-off-by: Dan Carpenter >> Reviewed-by: Ian Abbott >> Signed-off-by: Greg Kroah-Hartman >> --- >> drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c >> index b3bbec0a0d23..f89a863ea04c 100644 >> --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c >> +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c >> @@ -649,7 +649,7 @@ static int daqp_ao_insn_write(struct comedi_device *dev, >> /* Make sure D/A update mode is direct update */ >> outb(0, dev->iobase + DAQP_AUX); >> >> - for (i = 0; i > insn->n; i++) { >> + for (i = 0; i < insn->n; i++) { >> val = data[0]; >> val &= 0x0fff; >> val ^= 0x0800; /* Flip the sign */ -- -=( Ian Abbott || Web: www.mev.co.uk )=- -=( MEV Ltd. is a company registered in England & Wales. )=- -=( Registered number: 02862268. Registered address: )=- -=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-