linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2]Staging:lustre:obdclass:linux:fix checkpatch.pl warnings
@ 2016-01-20 18:47 Bhumika Goyal
  2016-01-20 18:47 ` [PATCH 1/2] Staging:lustre:obdclass:linux:remove unnecessary braces Bhumika Goyal
  2016-01-20 18:47 ` [PATCH 2/2] Staging:lustre:obdclass:linux:simplify NULL comparison Bhumika Goyal
  0 siblings, 2 replies; 4+ messages in thread
From: Bhumika Goyal @ 2016-01-20 18:47 UTC (permalink / raw)
  To: oleg.drokin, gregkh
  Cc: andreas.dilger, linux-kernel, devel, lustre-devel, Bhumika Goyal

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(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Staging:lustre:obdclass:linux:remove unnecessary braces
  2016-01-20 18:47 [PATCH 0/2]Staging:lustre:obdclass:linux:fix checkpatch.pl warnings Bhumika Goyal
@ 2016-01-20 18:47 ` Bhumika Goyal
  2016-01-20 19:06   ` Joe Perches
  2016-01-20 18:47 ` [PATCH 2/2] Staging:lustre:obdclass:linux:simplify NULL comparison Bhumika Goyal
  1 sibling, 1 reply; 4+ messages in thread
From: Bhumika Goyal @ 2016-01-20 18:47 UTC (permalink / raw)
  To: oleg.drokin, gregkh
  Cc: andreas.dilger, linux-kernel, devel, lustre-devel, Bhumika Goyal

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

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index a055cbb..9663ae3 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -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);
 	}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Staging:lustre:obdclass:linux:simplify NULL comparison
  2016-01-20 18:47 [PATCH 0/2]Staging:lustre:obdclass:linux:fix checkpatch.pl warnings Bhumika Goyal
  2016-01-20 18:47 ` [PATCH 1/2] Staging:lustre:obdclass:linux:remove unnecessary braces Bhumika Goyal
@ 2016-01-20 18:47 ` Bhumika Goyal
  1 sibling, 0 replies; 4+ messages in thread
From: Bhumika Goyal @ 2016-01-20 18:47 UTC (permalink / raw)
  To: oleg.drokin, gregkh
  Cc: andreas.dilger, linux-kernel, devel, lustre-devel, Bhumika Goyal

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

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 9663ae3..11fe6cb 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -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 */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] Staging:lustre:obdclass:linux:remove unnecessary braces
  2016-01-20 18:47 ` [PATCH 1/2] Staging:lustre:obdclass:linux:remove unnecessary braces Bhumika Goyal
@ 2016-01-20 19:06   ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2016-01-20 19:06 UTC (permalink / raw)
  To: Bhumika Goyal, oleg.drokin, gregkh
  Cc: andreas.dilger, linux-kernel, devel, lustre-devel

On Thu, 2016-01-21 at 00:17 +0530, Bhumika Goyal wrote:
> Fixed 'braces {} are not necessary for single statement blocks'
> checkpatch.pl warning.
[]
> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
[]
> @@ -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;

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-20 19:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-20 18:47 [PATCH 0/2]Staging:lustre:obdclass:linux:fix checkpatch.pl warnings Bhumika Goyal
2016-01-20 18:47 ` [PATCH 1/2] Staging:lustre:obdclass:linux:remove unnecessary braces Bhumika Goyal
2016-01-20 19:06   ` Joe Perches
2016-01-20 18:47 ` [PATCH 2/2] Staging:lustre:obdclass:linux:simplify NULL comparison Bhumika Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).