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: <20250906143119.21803-1-chiru.cezar.89@gmail.com>
Date: Sat,  6 Sep 2025 17:31:19 +0300
From: Cezar Chiru <chiru.cezar.89@...il.com>
To: wsa+renesas@...g-engineering.com
Cc: linux-i2c@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Cezar Chiru <chiru.cezar.89@...il.com>
Subject: [PATCH] i2c: i2c-dev: Fixed warnings generated by checkpatch tool

Fixed all warnings in i2c-dev.c file in drivers/i2c/ folder
The errors were: missing '*' from multiple line comment blocks,
missing new blank line after declarations and found 'unsigned'
instead of 'unsigned int'.
My motivation was to fix all possible warnings and errors from
/drivers/i2c/ subsystem. I will skip false positives.
Testing:
   * Built kernel with I2C_CHARDEV=y + my patch on and it succeeded.
   Date of last git pull: 06-September-2025 around 12:00 UTC + 03:00
   Latest commit SHA: d1d10cea0895
   Build succeeded
   * Installed kernel and external modules on my laptop with Ubuntu 24
   * Checked dmesg for i2c-dev using grep and checked for errors or
     success. Found 1 line related to i2c_dev:
     [    0.662406] i2c_dev: i2c /dev entries driver

Signed-off-by: Cezar Chiru <chiru.cezar.89@...il.com>
---
 drivers/i2c/i2c-dev.c | 51 +++++++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 19 deletions(-)

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index e9577f920286..0902b7b9cca6 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -1,16 +1,18 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
-    i2c-dev.c - i2c-bus driver, char device interface
-
-    Copyright (C) 1995-97 Simon G. Vogl
-    Copyright (C) 1998-99 Frodo Looijaard <frodol@....nl>
-    Copyright (C) 2003 Greg Kroah-Hartman <greg@...ah.com>
-
-*/
+ *   i2c-dev.c - i2c-bus driver, char device interface
+ *
+ *   Copyright (C) 1995-97 Simon G. Vogl
+ *   Copyright (C) 1998-99 Frodo Looijaard <frodol@....nl>
+ *   Copyright (C) 2003 Greg Kroah-Hartman <greg@...ah.com>
+ *
+ */
 
-/* Note that this is a complete rewrite of Simon Vogl's i2c-dev module.
-   But I have used so much of his original code and ideas that it seems
-   only fair to recognize him as co-author -- Frodo */
+/*
+ * Note that this is a complete rewrite of Simon Vogl's i2c-dev module.
+ *  But I have used so much of his original code and ideas that it seems
+ *  only fair to recognize him as co-author -- Frodo
+ */
 
 /* The I2C_RDWR ioctl code is written by Kolja Waschk <waschk@...os.de> */
 
@@ -50,7 +52,7 @@ struct i2c_dev {
 static LIST_HEAD(i2c_dev_list);
 static DEFINE_SPINLOCK(i2c_dev_list_lock);
 
-static struct i2c_dev *i2c_dev_get_by_minor(unsigned index)
+static struct i2c_dev *i2c_dev_get_by_minor(unsigned int index)
 {
 	struct i2c_dev *i2c_dev;
 
@@ -222,9 +224,11 @@ static int i2cdev_check_mux_children(struct device *dev, void *addrp)
 	return result;
 }
 
-/* This address checking function differs from the one in i2c-core
-   in that it considers an address with a registered device, but no
-   driver bound to it, as NOT busy. */
+/*
+ * This address checking function differs from the one in i2c-core
+ *  in that it considers an address with a registered device, but no
+ *  driver bound to it, as NOT busy.
+ */
 static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr)
 {
 	struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter);
@@ -241,7 +245,7 @@ static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr)
 }
 
 static noinline int i2cdev_ioctl_rdwr(struct i2c_client *client,
-		unsigned nmsgs, struct i2c_msg *msgs)
+		unsigned int nmsgs, struct i2c_msg *msgs)
 {
 	u8 __user **data_ptrs;
 	int i, res;
@@ -297,6 +301,7 @@ static noinline int i2cdev_ioctl_rdwr(struct i2c_client *client,
 	}
 	if (res < 0) {
 		int j;
+
 		for (j = 0; j < i; ++j)
 			kfree(msgs[j].buf);
 		kfree(data_ptrs);
@@ -337,8 +342,10 @@ static noinline int i2cdev_ioctl_smbus(struct i2c_client *client,
 			size);
 		return -EINVAL;
 	}
-	/* Note that I2C_SMBUS_READ and I2C_SMBUS_WRITE are 0 and 1,
-	   so the check is valid if size==I2C_SMBUS_QUICK too. */
+	/*
+	 * Note that I2C_SMBUS_READ and I2C_SMBUS_WRITE are 0 and 1,
+	 * so the check is valid if size==I2C_SMBUS_QUICK too.
+	 */
 	if ((read_write != I2C_SMBUS_READ) &&
 	    (read_write != I2C_SMBUS_WRITE)) {
 		dev_dbg(&client->adapter->dev,
@@ -380,8 +387,10 @@ static noinline int i2cdev_ioctl_smbus(struct i2c_client *client,
 			return -EFAULT;
 	}
 	if (size == I2C_SMBUS_I2C_BLOCK_BROKEN) {
-		/* Convert old I2C block commands to the new
-		   convention. This preserves binary compatibility. */
+		/*
+		 * Convert old I2C block commands to the new
+		 * convention. This preserves binary compatibility.
+		 */
 		size = I2C_SMBUS_I2C_BLOCK_DATA;
 		if (read_write == I2C_SMBUS_READ)
 			temp.block[0] = I2C_SMBUS_BLOCK_MAX;
@@ -471,6 +480,7 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 	case I2C_SMBUS: {
 		struct i2c_smbus_ioctl_data data_arg;
+
 		if (copy_from_user(&data_arg,
 				   (struct i2c_smbus_ioctl_data __user *) arg,
 				   sizeof(struct i2c_smbus_ioctl_data)))
@@ -531,6 +541,7 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
 {
 	struct i2c_client *client = file->private_data;
 	unsigned long funcs;
+
 	switch (cmd) {
 	case I2C_FUNCS:
 		funcs = i2c_get_functionality(client->adapter);
@@ -560,6 +571,7 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
 		p = compat_ptr(rdwr_arg.msgs);
 		for (i = 0; i < rdwr_arg.nmsgs; i++) {
 			struct i2c_msg32 umsg;
+
 			if (copy_from_user(&umsg, p + i, sizeof(umsg))) {
 				kfree(rdwr_pa);
 				return -EFAULT;
@@ -578,6 +590,7 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
 	}
 	case I2C_SMBUS: {
 		struct i2c_smbus_ioctl_data32	data32;
+
 		if (copy_from_user(&data32,
 				   (void __user *) arg,
 				   sizeof(data32)))
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ