Re: [PATCH v3] staging: vc04_services: Avoid NULL comparison

2019-10-09 Thread Dan Carpenter
On Tue, Oct 08, 2019 at 07:44:15PM -0700, Nachammai Karuppiah wrote:
> Remove NULL comparison. Issue found using checkpatch.pl
> 
> Signed-off-by: Nachammai Karuppiah 
> 
> ---
> 
> Changes in V2
>- Remove all NULL comparisons in vc04_services/interface directory.
> ---
> 
> changes in V3
>- Fixed warnings. Reported-by: kbuild test robot 
> ---
> 
> Signed-off-by: Nachammai Karuppiah 
> ---
>  .../interface/vchiq_arm/vchiq_2835_arm.c   |  4 ++--


Only one --- cut off line is needed.  You have two Signed-of-by lines
as well.  It should just be:

Remove NULL comparison. Issue found using checkpatch.pl

Signed-off-by: Nachammai Karuppiah 
---
Changes in V2
   - Remove all NULL comparisons in vc04_services/interface directory.
changes in V3
   - Fixed warnings. Reported-by: kbuild test robot 

  .../interface/vchiq_arm/vchiq_2835_arm.c   |  4 ++--

But this doesn't affect the final patch, and we can see all the
information so it's fine.  No need to resend.

Reviewed-by: Dan Carpenter 

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging: vc04_services: Avoid NULL comparison

2019-10-08 Thread Nachammai Karuppiah
Remove NULL comparison. Issue found using checkpatch.pl

Signed-off-by: Nachammai Karuppiah 

---

Changes in V2
   - Remove all NULL comparisons in vc04_services/interface directory.
---

changes in V3
   - Fixed warnings. Reported-by: kbuild test robot 
---

Signed-off-by: Nachammai Karuppiah 
---
 .../interface/vchiq_arm/vchiq_2835_arm.c   |  4 ++--
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c  | 22 +++---
 .../vc04_services/interface/vchiq_arm/vchiq_core.c |  4 ++--
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 8dc730c..7cdb21e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -526,11 +526,11 @@ create_pagelist(char __user *buf, size_t count, unsigned 
short type)
return NULL;
}
 
-   WARN_ON(g_free_fragments == NULL);
+   WARN_ON(!g_free_fragments);
 
down(&g_free_fragments_mutex);
fragments = g_free_fragments;
-   WARN_ON(fragments == NULL);
+   WARN_ON(!fragments);
g_free_fragments = *(char **) g_free_fragments;
up(&g_free_fragments_mutex);
pagelist->type = PAGELIST_READ_WITH_FRAGMENTS +
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index b1595b1..d7d9c7c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -827,7 +827,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
/* Remove all services */
i = 0;
while ((service = next_service_by_instance(instance->state,
-   instance, &i)) != NULL) {
+   instance, &i))) {
status = vchiq_remove_service(service->handle);
unlock_service(service);
if (status != VCHIQ_SUCCESS)
@@ -907,7 +907,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
&args.params, srvstate,
instance, user_service_free);
 
-   if (service != NULL) {
+   if (service) {
user_service->service = service;
user_service->userdata = userdata;
user_service->instance = instance;
@@ -988,7 +988,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg;
 
service = find_service_for_instance(instance, handle);
-   if (service != NULL) {
+   if (service) {
status = (cmd == VCHIQ_IOC_USE_SERVICE) ?
vchiq_use_service_internal(service) :
vchiq_release_service_internal(service);
@@ -1021,7 +1021,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 
service = find_service_for_instance(instance, args.handle);
 
-   if ((service != NULL) && (args.count <= MAX_ELEMENTS)) {
+   if (service && (args.count <= MAX_ELEMENTS)) {
/* Copy elements into kernel space */
struct vchiq_element elements[MAX_ELEMENTS];
 
@@ -1343,11 +1343,11 @@ vchiq_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
spin_unlock(&msg_queue_spinlock);
 
complete(&user_service->remove_event);
-   if (header == NULL)
+   if (!header)
ret = -ENOTCONN;
else if (header->size <= args.bufsize) {
/* Copy to user space if msgbuf is not NULL */
-   if ((args.buf == NULL) ||
+   if (!args.buf ||
(copy_to_user((void __user *)args.buf,
header->data,
header->size) == 0)) {
@@ -1426,7 +1426,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg;
 
service = find_closed_service_for_instance(instance, handle);
-   if (service != NULL) {
+   if (service) {
struct user_service *user_service =
(struct user_service *)service->base.userdata;
close_delivered(user_service);
@@ -2223,13 +2223,13 @@ struct vchiq_st