Skip to contentSkip to conversation

Staging: greybus: Fix multiple checks for null pointers

PATCH Superseded Sumit Pundir 2 participants 3 messages Jan 8, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: greybus: Fix multiple checks for null pointers

Fixes the following coding style issue as noted by checkpatch.pl at multiple lines:

Comparison to NULL could be written "!token"

---
 drivers/staging/greybus/camera.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/greybus/camera.c +8 -8
index f13f16b..07ebfb8 100644
@@ -918,7 +918,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
 
 	/* Retrieve number of streams to configure */
 	token = strsep(&buf, ";");
-	if (token == NULL)
+	if (!token)
 		return -EINVAL;
 
 	ret = kstrtouint(token, 10, &nstreams);
@@ -929,7 +929,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
 		return -EINVAL;
 
 	token = strsep(&buf, ";");
-	if (token == NULL)
+	if (!token)
 		return -EINVAL;
 
 	ret = kstrtouint(token, 10, &flags);
@@ -946,7 +946,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
 
 		/* width */
 		token = strsep(&buf, ";");
-		if (token == NULL) {
+		if (!token) {
 			ret = -EINVAL;
 			goto done;
 		}
@@ -956,7 +956,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
 
 		/* height */
 		token = strsep(&buf, ";");
-		if (token == NULL)
+		if (!token)
 			goto done;
 
 		ret = kstrtouint(token, 10, &stream->height);
@@ -965,7 +965,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
 
 		/* Image format code */
 		token = strsep(&buf, ";");
-		if (token == NULL)
+		if (!token)
 			goto done;
 
 		ret = kstrtouint(token, 16, &stream->format);
@@ -1009,7 +1009,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera *gcam,
 
 	/* Request id */
 	token = strsep(&buf, ";");
-	if (token == NULL)
+	if (!token)
 		return -EINVAL;
 	ret = kstrtouint(token, 10, &request_id);
 	if (ret < 0)
@@ -1017,7 +1017,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera *gcam,
 
 	/* Stream mask */
 	token = strsep(&buf, ";");
-	if (token == NULL)
+	if (!token)
 		return -EINVAL;
 	ret = kstrtouint(token, 16, &streams_mask);
 	if (ret < 0)
@@ -1025,7 +1025,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera *gcam,
 
 	/* number of frames */
 	token = strsep(&buf, ";");
-	if (token == NULL)
+	if (!token)
 		return -EINVAL;
 	ret = kstrtouint(token, 10, &num_frames);
 	if (ret < 0)
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 6 lines · Sumit Pundir

Fixes the following coding style issue as noted by checkpatch.pl at multiple lines:

Comparison to NULL could be written "!token"

Since you're not really fixing anything here, besides silencing a checkpatch suggestion when run with the --strict option (or on staging code), I suggest you reword you commit summary (Subject) to, for example:

staging: greybus: camera: clean up NULL checks

or similar.

Note that I also added "camera" as a module prefix above.

Thanks,
Johan

#2 lore raw
Quoted 11 lines · Johan Hovold

Since you're not really fixing anything here, besides silencing a checkpatch suggestion when run with the --strict option (or on staging code), I suggest you reword you commit summary (Subject) to, for example:

staging: greybus: camera: clean up NULL checks

or similar.

Note that I also added "camera" as a module prefix above.

Hi Johan,

I will send a v2 of this patch with all the prescribed changes.

Thanks,
Sumit