Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753736AbcDRCd6 (ORCPT ); Sun, 17 Apr 2016 22:33:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36198 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753704AbcDRCdy (ORCPT ); Sun, 17 Apr 2016 22:33:54 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Irina Tirdea , Jonathan Cameron Subject: [PATCH 4.5 098/124] iio: fix config watermark initial value Date: Mon, 18 Apr 2016 11:29:30 +0900 Message-Id: <20160418022620.772423963@linuxfoundation.org> X-Mailer: git-send-email 2.8.0 In-Reply-To: <20160418022615.726954227@linuxfoundation.org> References: <20160418022615.726954227@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1278 Lines: 39 4.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Irina Tirdea commit 1bef2c1d4e4fd92bdf8219b13ba97ba861618254 upstream. config structure is set to 0 when updating the buffers, so by default config->watermark will be 0. When computing the minimum between config->watermark and the buffer->watermark or insert_buffer-watermark, this will always be 0 regardless of the value set by the user for the buffer. Set as initial value for config->watermark the maximum allowed value so that the minimum value will always be set from one of the buffers. Signed-off-by: Irina Tirdea Fixes: f0566c0c405d ("iio: Set device watermark based on watermark of all attached buffers") Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/industrialio-buffer.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -645,6 +645,7 @@ static int iio_verify_update(struct iio_ unsigned int modes; memset(config, 0, sizeof(*config)); + config->watermark = ~0; /* * If there is just one buffer and we are removing it there is nothing