Skip to contentSkip to conversation

Staging:lustre:obdclass:linux:fix checkpatch.pl warnings

PATCH In review Bhumika Goyal 2 participants 4 messages Jan 20, 2016 Staging

lore
Share & tools
lore
#0 lore raw

cover Staging:lustre:obdclass:linux:fix checkpatch.pl warnings

This patch series addresses checkpatch.pl warnings in lustre driver.

Bhumika Goyal (2):
Staging:lustre:obdclass:linux:remove unnecessary braces Staging:lustre:obdclass:linux:simplify NULL comparison

 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 Staging:lustre:obdclass:linux:remove unnecessary braces

Fixed 'braces {} are not necessary for single statement blocks' checkpatch.pl warning.

---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +2 -4
index a055cbb..9663ae3 100644
@@ -144,9 +144,8 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
 		offset += cfs_size_round(data->ioc_inllen3);
 	}
 
-	if (data->ioc_inllen4) {
+	if (data->ioc_inllen4)
 		data->ioc_inlbuf4 = &data->ioc_bulk[0] + offset;
-	}
 
 	return 0;
 
@@ -250,9 +249,8 @@ static ssize_t health_show(struct kobject *kobj, struct attribute *attr,
 		class_incref(obd, __func__, current);
 		read_unlock(&obd_dev_lock);
 
-		if (obd_health_check(NULL, obd)) {
+		if (obd_health_check(NULL, obd))
 			healthy = false;
-		}
 		class_decref(obd, __func__, current);
 		read_lock(&obd_dev_lock);
 	}
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 1/2] Staging:lustre:obdclass:linux:remove unnecessary braces

Quoted 2 lines · Bhumika Goyal

Fixed 'braces {} are not necessary for single statement blocks' checkpatch.pl warning.

[]

drivers/staging/lustre/lustre/obdclass/linux/linux-module.c

Quoted 1 line
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +0 -0

[]

Quoted 7 lines
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +0 -0
@@ -144,9 +144,8 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
  		offset += cfs_size_round(data->ioc_inllen3);
  	}

drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +1 -1
-	if (data->ioc_inllen4) {
+	if (data->ioc_inllen4)

  data->ioc_inlbuf4 = &data->ioc_bulk[0] + offset;

You might also consider converting uses of &foo[0] to foo

#3 lore raw

PATCH 2/2 Staging:lustre:obdclass:linux:simplify NULL comparison

In reply to Bhumika Goyal

Remove explicit NULL comparision and replace it with a simpier form. Detected using checkpatch.pl.

---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +3 -3
index 9663ae3..11fe6cb 100644
@@ -239,7 +239,7 @@ static ssize_t health_show(struct kobject *kobj, struct attribute *attr,
 		struct obd_device *obd;
 
 		obd = class_num2obd(i);
-		if (obd == NULL || !obd->obd_attached || !obd->obd_set_up)
+		if (!obd || !obd->obd_attached || !obd->obd_set_up)
 			continue;
 
 		LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
@@ -358,7 +358,7 @@ static int obd_device_list_seq_show(struct seq_file *p, void *v)
 	struct obd_device *obd = class_num2obd((int)index);
 	char *status;
 
-	if (obd == NULL)
+	if (!obd)
 		return 0;
 
 	LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
@@ -422,7 +422,7 @@ int class_procfs_init(void)
 	struct dentry *file;
 
 	lustre_kobj = kobject_create_and_add("lustre", fs_kobj);
-	if (lustre_kobj == NULL)
+	if (!lustre_kobj)
 		goto out;
 
 	/* Create the files associated with this kobject */
Signature · 1 line
1.9.1