From patchwork Thu Apr 25 15:03:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13643472 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9837C10F15 for ; Thu, 25 Apr 2024 15:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3Kuni48f6MRtx5BkhiVU16P5sVD0yInI+qDIhcZD2Sw=; b=uSsRn1ez5wUQj3 /kCqQCqkw9bNlnzCIFHJjwRDK09vST7TmkdlH8kUnZ9elvHl06rTANVZoIxh7/MNleVWnxgxZvbCH DA3iFr3AdF3odlz2jUREt+sI7gvBjC4iy36XIM6WEZWG10UL82k0Crllmtmt1FSubEzWfSnyynV8+ MxesYf/Xgp13GL86J6lKTBto8CoOkw4jqRCHV0gXO15Je3uLxm+1FxHIK3cmHvYm9s83M1Y5eZOm1 f8dgChNnGjFDVL1wMOWQ6WDHBiQ12cMP6cypbkhrxqE6f2GcFBEMw0ncWqItJl0sqQfVViEvq9kZV eVYW5PNJfgZSfeeql6SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s00dn-000000090DF-18vZ; Thu, 25 Apr 2024 15:04:03 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s00dR-0000000903A-3XHL for linux-arm-kernel@lists.infradead.org; Thu, 25 Apr 2024 15:03:44 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-23a9d3c9153so549837fac.1 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=lists.infradead.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=u0ox4cp81ffYdwbB0lCynZ7tsIGuXyczBFsM4IqpaS0shFyy8tpVFIiryoioH2aFNU sIvTD9fnOhsg6XrRSiNUiUkhustqzu7g8oJn3hHKHK/ppByhERQeF8GX/eDjwQ46zVLw mSnsU6T6tybOLsFHeiow8FGn2Mc/Cli/0Px0/dhiMK/7D9vopDIu5GNxOxoZyYjmlkQK LabHoepV1dXXrVJz23+LWxvA7+HeEqmWiyJhLtfTPt9hv/Eq8xXDp8uf3z6a9euWIFhu ckECl1isVe/3x9FbFow2bbxCHXw5C4wStl2OrZkKqdBa2RawSrGuQqrx2HzHNqoJP7+j CMGQ== 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=SPj1YOWDzOGFbq+fr34wHyMIxfcvt7wgzmvjHkDS8S9cbdQPwNH8Fr5XRBR/zg0inE /44pvqA5rLoz368gHZsp8OybWDvb/j5/+yu49aWYHksV2h6FJYk+SVlEYU8i35QWKXMM Y54NkItpr7L+kNytQ/ENfHSZt1TH163w+nJ6WH+BJJ4Ss1MR+arxxqlWZaMj5OUCKEsm MYy3DGLTCnxs53mMddhQipe0vTUFGJr/9po9cABcUyHaGBWgAKRq8XyVNgRAMLmuhSaO niismR2JA7fBsg50mGwfd+QnCjMT+pHHaRwvTcici8AV6EgtlTqazIkCaKM1BOAwVfOt hV3A== X-Forwarded-Encrypted: i=1; AJvYcCUL6HMBk9t3v6SqmPcjAu+OcCp+Sfortu6knZlDBJbT7l1ZFY9MZ2TjuV8UU5lwLG4XuHGayCUQrD6DQv74trlPgxQhUas2hfia5r336plLtoEbto0= X-Gm-Message-State: AOJu0YzSRhIP9uRtLlUf8ApHPIRKvlhtGmbSP+2DKIAtbAMaBXaE/kbG us7jXisk8GllseyOrlO7fyIft1wxa3SZKNvyHX6cUH9HCalQYMRUp9LMe0XSZeU= X-Google-Smtp-Source: AGHT+IF+ytB1gMG5gdlzfQf5qI8kdu3jxsrVIZyaQCoI1mcDdWPMWQNB0NwCuMDh4O5EGMwTLzBV2A== 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> MIME-Version: 1.0 X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240425_080341_966295_9EE933B4 X-CRM114-Status: GOOD ( 15.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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);