staging: vc04_services: Avoid NULL comparison
Subsystems (2)
PATCH v3 1/1 staging: vc04_services: Avoid NULL comparison
Remove NULL comparison. Issue found using checkpatch.pl
---
Changes in V2
- Remove all NULL comparisons in vc04_services/interface directory.
---
changes in V3
- Fixed warnings. Reported-by: kbuild test robot <[email protected]>
---
--- .../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(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +2 -2
@@ -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 +
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +11 -11
@@ -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_state *vchiq_get_state (void) { -if (g_state.remote ==NULL ) +if (!g_state.remote)printk (KERN_ERR "%s: g_state.remote == NULL\n" , __func__);else if (g_state.remote->initialised !=1 )printk (KERN_NOTICE "%s: g_state.remote->initialised != 1 (%d)\n" , __func__, g_state.remote->initialised); -return ((g_state.remote !=NULL ) && +return (g_state.remote && (g_state.remote->initialised ==1 )) ? &g_state :NULL ; }
@@ -2924,7 +2924,7 @@ vchiq_instance_get_use_count(VCHIQ_INSTANCE_T instance) i =0 ;while ((service =next_service_by_instance (instance->state, - instance, &i)) !=NULL ) { + instance, &i))) { use_count += service->service_use_count;unlock_service (service); }
@@ -2951,7 +2951,7 @@ vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace) i =0 ;while ((service =next_service_by_instance (instance->state, - instance, &i)) !=NULL ) { + instance, &i))) { service->trace = trace;unlock_service (service); }
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +2 -2
@@ -542,7 +542,7 @@ reserve_space(struct vchiq_state *state, size_t space, int is_blocking)if (space > slot_space) {struct vchiq_header *header;/* Fill the remaining space with padding */ -WARN_ON (state->tx_data ==NULL ); +WARN_ON (!state->tx_data); header = (struct vchiq_header *) (state->tx_data + (tx_pos &VCHIQ_SLOT_MASK )); header->msgid =VCHIQ_MSGID_PADDING ;
@@ -3578,7 +3578,7 @@ void vchiq_log_dump_mem(const char *label, u32 addr, const void *void_mem, } *s++ ='\0' ; -if ((label !=NULL ) && (*label !='\0' )) +if (label && (*label !='\0' ))vchiq_log_trace (VCHIQ_LOG_TRACE ,"%s: %08x: %s" , label, addr, line_buf);else
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +1 -1
@@ -628,7 +628,7 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, } } -return (service !=NULL ) ?0 :-1 ; +return service ?0 :-1 ; }EXPORT_SYMBOL (vchi_service_open);
Signature · 1 line
2.7.4
Quoted 10 lines · Nachammai Karuppiah
Remove NULL comparison. Issue found using checkpatch.pl
Signed-off-by Nachammai Karuppiah <[email protected]>---
Changes in V2
- Remove all NULL comparisons in vc04_services/interface directory.
---
Quoted 7 lines
changes in V3
- Fixed warnings. Reported-by: kbuild test robot <[email protected]>
---Signed-off-by Nachammai Karuppiah <[email protected]>--- .../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
---
Changes in V2
- Remove all NULL comparisons in vc04_services/interface directory.
changes in V3
- Fixed warnings. Reported-by: kbuild test robot <[email protected]>
.../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.
regards,
dan carpenter