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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260204061219.791037-2-harshit.m.mogalapalli@oracle.com>
Date: Tue,  3 Feb 2026 22:11:56 -0800
From: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
To: Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>,
        Nuno Sá <nuno.sa@...log.com>,
        Andy Shevchenko <andy@...nel.org>,
        Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
        Gustavo Bastos <gustavobastos@....br>,
        Antoniu Miclaus <antoniu.miclaus@...log.com>,
        Andrew Ijano <andrew.ijano@...il.com>, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, error27@...il.com,
        andriy.shevchenko@...el.com
Subject: [PATCH v4 next 1/6] iio: sca3000: reuse device pointer for devm helpers

Cache struct device *dev and feed it to the devm helpers to simplify
the probe function. While at it, also use reverse christmas tree order
for local variables.

No functional changes.

Suggested-by: Andy Shevchenko <andriy.shevchenko@...el.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...el.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
---
v3->v4: Add RB from Andy and use a single line for
devm_iio_kfifo_buffer_setup()
---
 drivers/iio/accel/sca3000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
index 9ef4d6e27466..fa0ec2e1a1a2 100644
--- a/drivers/iio/accel/sca3000.c
+++ b/drivers/iio/accel/sca3000.c
@@ -1439,11 +1439,12 @@ static const struct iio_info sca3000_info = {
 
 static int sca3000_probe(struct spi_device *spi)
 {
-	int ret;
+	struct device *dev = &spi->dev;
 	struct sca3000_state *st;
 	struct iio_dev *indio_dev;
+	int ret;
 
-	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
 	if (!indio_dev)
 		return -ENOMEM;
 
@@ -1466,8 +1467,7 @@ static int sca3000_probe(struct spi_device *spi)
 	}
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
-	ret = devm_iio_kfifo_buffer_setup(&spi->dev, indio_dev,
-					  &sca3000_ring_setup_ops);
+	ret = devm_iio_kfifo_buffer_setup(dev, indio_dev, &sca3000_ring_setup_ops);
 	if (ret)
 		return ret;
 
-- 
2.47.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ