Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1197830lqd; Thu, 25 Apr 2024 08:30:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUS5PGWP5qE6jWGAd8O8bYMn382n2O2CLzhm6E86wIH7K/JFSPLk8u/g81+PKxXFdYEB6XrpRRrYIB1waTcNl5roNaDW/WchXRTyR/adg== X-Google-Smtp-Source: AGHT+IFIll/Yr0CIilFqwNETyFfGDF8xvvSDlateTeVPr5h7GmTDZQl97u3yYkQZoudPkJfPg/lg X-Received: by 2002:a17:90b:b14:b0:2a8:1fdf:b1b0 with SMTP id bf20-20020a17090b0b1400b002a81fdfb1b0mr5757282pjb.29.1714059006631; Thu, 25 Apr 2024 08:30:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714059006; cv=pass; d=google.com; s=arc-20160816; b=R7TUeAfX3NYfW/Mxaje7pf5HY8LuuEuWOapdlzbe5zbQ37V35wQmeHOjei6mxGUnrw NncD3u8LFG1cQCBbzzksr1sdMnT4uQ26aGTEe42+Icu08CZehXqBKPbQLptuKREwDDce wi0fE+U908Ur7QuG6Tl2D8zXVj5e5r6/sr9P9vcADcuw3IhWZWJ7pQXnFLUCrG93TkGM G1BedYx71HnXzRIGldPxiHlbkLLB1EWeEliBBKGCUUErALNLvFgazwmjeuld384cstAZ BsdFmvSblPqcFIMmLwKjNrBbYlrV5O0o3YrIp6+/jomYPYM9n2AOEJHgGWpgmdS2Q/EK DB2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ALDEBHn1/H2TDQekY233nOtWpDkhb+DBBbFG5htxIm8=; fh=wKdiXIWcw/WWOZg9VkyQyMRyU8sxPEFQhLKZ5PNxOvc=; b=yIIViRWJNUIvuT+Y32dtnN0+AyZkPiez4E9gG6zSV/U7eGX+gP2gyQmqBv7WgIo3fP ec5zv/YYvYTp1yAN+MSkm20KIrEKRAdajD1S6gsgdsmQ/B0yi0QVSa5gVRBl0fneDa8g hWbrUWLu0KHR9mUFPVruXga3V3XxngoNgCX/zpLwp1gKU2ckNGGqeOSYjsflywdyoq+C ObDlyTF9OXhqirT13x6FbaRgIDxRC8108i2WqgV0ZTYkWF+BU8J3WpAdAjxZgKZQMeMp WEXe3ubz/Ko8Fg7Qhoxsa2Hf/VO4bVULMggo5ZC+V/r3PaKoYyKT9xsio784gVD/4rar 9Wjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=TIpy5pPs; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-158756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158756-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s2-20020a17090a698200b002a28be9e69fsi13699880pjj.130.2024.04.25.08.30.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 08:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=TIpy5pPs; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-158756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158756-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 80557B25C19 for ; Thu, 25 Apr 2024 15:04:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED2D714B065; Thu, 25 Apr 2024 15:03:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="TIpy5pPs" Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1D9E14A603 for ; Thu, 25 Apr 2024 15:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714057419; cv=none; b=KckDQv9cBNot9l7kLhjr4lO4keyIvpwMPZjVOgkneHPBluLgZAvcsONX4VuYdt4oaPVboViERUwhqueFf/seB3QATGwAY2ypa9FxxcA41llgIga7CgRuAaV+j44DxBgutugBnOC5KDW+C379Ic0qBQNfGjl5q87GOX720+AB89w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714057419; c=relaxed/simple; bh=InEifnlaJ03rA8QgNLlhw6s+Q05Y2oXvccfChwmxIgw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Olmdw8aJM1qwwpgK8LGNWHzaSoMzMhoFrbVzF1sFvbCDpfNKh+81MW/uaZ24BpZlffVLF+ar1E9o7ZjMUmzNCrmUqouM27nipdQmW1q3vHDsd4QyQ4zD4og8hx3LyZiEwSgCYbyBFmp/S9lyjwzJ4lvxGQq98+ar6mpIoHvZbMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=TIpy5pPs; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-22edbef3b4eso386342fac.3 for ; Thu, 25 Apr 2024 08:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1714057417; x=1714662217; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ALDEBHn1/H2TDQekY233nOtWpDkhb+DBBbFG5htxIm8=; b=TIpy5pPseRhnmR9FLqscjBFlJRI02XbEEfKOTANAFpAwSn6p5pHfYOVnIiUP4/lVR0 SCKs5RJgvLEh3rRb0B81op9pcu46ZfsUXwvYnuS/MC5NRTuIvi0+tQ6XV9UL/J1LXUyz aWgVBNUa7mk1f9YLIeCFlhmG9O7et2EdzgopMH5N6yIib3QkFUp+2cAWo5GrSVDJkfW9 xEHr32rfuW2DbAQj9sh2djMryNRaUOhRwCptyrPdiVnzNK7xIdemr8RwDenECAQVIwp9 AYMicp9POLOtRaLRBcTCcgxqMNXjL86AXoWRMsEe+5/QwdH8VBM5fBvfzA6BY7RHhl0f 3bKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714057417; x=1714662217; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ALDEBHn1/H2TDQekY233nOtWpDkhb+DBBbFG5htxIm8=; b=RFLOqcTC9sIReDBGzxRCeIbUFPWzTNfx6y0Gztw4gvOAgbVnkuktIN+1R0+q1vqtLs KSCAuIQj8f9P9sQCZC7pnNVJMFsAP7mzasHI8/jtSnryQaTknoYBrhNOfidQ39qiIzBB AauyRfk5jPd6/ETKQ44/3nDmsVvBx795G0nzCu6rFzMow1nG9H1VqIPkRA1mwKs9lX4w mglt0fNeNuUXhx1xL4I+WohOOZMSsNYD8KjdBQB9VCRXHdfQ/nQBj5/J3qr9risIvhsg JgH79kiogtpgtEOXQjrIrTWj0aYnmJlEMl/mkDhrbEdFP81KKw2Dq3h9v6Pbibkk+lSl KMMQ== X-Forwarded-Encrypted: i=1; AJvYcCV6PKVR1bXtqs8Ug7RQXliQfR4GQFGTr0apXgnVco77OsbATpkPop0PKcOAsHxVDuBzOiri7b6TGuGGqzfeyxHs+XiWpM+h1q6/urpI X-Gm-Message-State: AOJu0YyNV2ckp2dsWN4bgVrdLO0FAby3NPVoPPdZMuvxP4EETCo2Xyy9 LO2ntAu4o3t8BlE3fh2CzwG+MRCTFToMMs9lt16eXLfZKgUHLu8XLrJr/ncSTrk= X-Received: by 2002:a05:6870:c394:b0:23b:8a59:f5b4 with SMTP id g20-20020a056870c39400b0023b8a59f5b4mr702248oao.2.1714057416777; Thu, 25 Apr 2024 08:03:36 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id mp2-20020a056871328200b0023b6d4723edsm166739oac.14.2024.04.25.08.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 08:03:36 -0700 (PDT) From: David Lechner To: Jonathan Cameron Cc: David Lechner , Lars-Peter Clausen , Michael Hennerich , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] iio: buffer: initialize masklength accumulator to 0 Date: Thu, 25 Apr 2024 10:03:29 -0500 Message-ID: <20240425-b4-iio-masklength-cleanup-v1-3-d3d16318274d@baylibre.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240425-b4-iio-masklength-cleanup-v1-0-d3d16318274d@baylibre.com> References: <20240425-b4-iio-masklength-cleanup-v1-0-d3d16318274d@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.12.4 Content-Transfer-Encoding: 8bit Since masklength is marked as [INTERN], no drivers should assign it and the value will always be 0. Therefore, the local ml accumulator variable in iio_buffers_alloc_sysfs_and_mask() will always start out as 0. This changes the code to explicitly set ml to 0 to make it clear that drivers should not be trying to override the masklength field. Signed-off-by: David Lechner --- drivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 1d950a3e153b..cec58a604d73 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -1744,7 +1744,7 @@ int iio_buffers_alloc_sysfs_and_mask(struct iio_dev *indio_dev) channels = indio_dev->channels; if (channels) { - int ml = indio_dev->masklength; + int ml = 0; for (i = 0; i < indio_dev->num_channels; i++) ml = max(ml, channels[i].scan_index + 1); -- 2.43.2