lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220818125844.60762-1-joetalbott@gmail.com>
Date:   Thu, 18 Aug 2022 08:58:44 -0400
From:   Joe Simmons-Talbott <joetalbott@...il.com>
To:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Joe Simmons-Talbott <joetalbott@...il.com>
Subject: [PATCH] iio: Avoid multiple line dereference for mask

Add a mask variable to hold dereferences that span multiple lines.
Found with checkpatch.pl.

Signed-off-by: Joe Simmons-Talbott <joetalbott@...il.com>
---
 drivers/iio/industrialio-core.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 67d3d01d2dac..549f2254c258 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -1291,6 +1291,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
 	struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
 	int ret, attrcount = 0;
 	const struct iio_chan_spec_ext_info *ext_info;
+	long *mask;
 
 	if (chan->channel < 0)
 		return 0;
@@ -1301,10 +1302,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
 		return ret;
 	attrcount += ret;
 
+	mask = &chan->info_mask_separate_available;
 	ret = iio_device_add_info_mask_type_avail(indio_dev, chan,
-						  IIO_SEPARATE,
-						  &chan->
-						  info_mask_separate_available);
+						  IIO_SEPARATE, mask);
 	if (ret < 0)
 		return ret;
 	attrcount += ret;
@@ -1316,10 +1316,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
 		return ret;
 	attrcount += ret;
 
+	mask = &chan->info_mask_shared_by_type_available;
 	ret = iio_device_add_info_mask_type_avail(indio_dev, chan,
-						  IIO_SHARED_BY_TYPE,
-						  &chan->
-						  info_mask_shared_by_type_available);
+						  IIO_SHARED_BY_TYPE, mask);
 	if (ret < 0)
 		return ret;
 	attrcount += ret;
@@ -1331,9 +1330,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
 		return ret;
 	attrcount += ret;
 
+	mask = &chan->info_mask_shared_by_dir_available;
 	ret = iio_device_add_info_mask_type_avail(indio_dev, chan,
-						  IIO_SHARED_BY_DIR,
-						  &chan->info_mask_shared_by_dir_available);
+						  IIO_SHARED_BY_DIR, mask);
 	if (ret < 0)
 		return ret;
 	attrcount += ret;
@@ -1345,9 +1344,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
 		return ret;
 	attrcount += ret;
 
+	mask = &chan->info_mask_shared_by_all_available;
 	ret = iio_device_add_info_mask_type_avail(indio_dev, chan,
-						  IIO_SHARED_BY_ALL,
-						  &chan->info_mask_shared_by_all_available);
+						  IIO_SHARED_BY_ALL, mask);
 	if (ret < 0)
 		return ret;
 	attrcount += ret;
-- 
2.37.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ