Commit da3a04a1 authored by Flavio Ceolin's avatar Flavio Ceolin Committed by Anas Nashif
Browse files

lib: fdtable: Code guideline fixes



Fixes violations code guideline related with essential types rules:

- Use explicit comparison with 0 or NULL to avoid boolean promotion

Signed-off-by: default avatarFlavio Ceolin <flavio.ceolin@intel.com>
Signed-off-by: default avatarAbramo Bagnara <abramo.bagnara@bugseng.com>
parent bbc6f78c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ static int z_fd_unref(int fd)
	 */
	do {
		old_rc = atomic_get(&fdtable[fd].refcount);
		if (!old_rc) {
		if (old_rc == 0) {
			return 0;
		}
	} while (!atomic_cas(&fdtable[fd].refcount, old_rc, old_rc - 1));
@@ -113,7 +113,7 @@ static int _check_fd(int fd)

	fd = k_array_index_sanitize(fd, ARRAY_SIZE(fdtable));

	if (!atomic_get(&fdtable[fd].refcount)) {
	if (atomic_get(&fdtable[ufd].refcount) == 0) {
		errno = EBADF;
		return -1;
	}
@@ -198,7 +198,7 @@ void z_finalize_fd(int fd, void *obj, const struct fd_op_vtable *vtable)
	 * for something. For BSD sockets, the lock is used with condition
	 * variables to avoid keeping the lock for a long period of time.
	 */
	if (vtable && vtable->ioctl) {
	if ((vtable != NULL) && (vtable->ioctl != NULL)) {
		(void)z_fdtable_call_ioctl(vtable, obj, ZFD_IOCTL_SET_LOCK,
					   &fdtable[fd].lock);
	}