deal with the last remaing boolean uses of fd_file()

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2024-06-06 19:29:04 -04:00
parent 457a654939
commit 38052c2dd7
3 changed files with 5 additions and 7 deletions

View File

@ -584,7 +584,7 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
if (cmd.fd != -1) { if (cmd.fd != -1) {
/* search for file descriptor */ /* search for file descriptor */
f = fdget(cmd.fd); f = fdget(cmd.fd);
if (!fd_file(f)) { if (fd_empty(f)) {
ret = -EBADF; ret = -EBADF;
goto err_tree_mutex_unlock; goto err_tree_mutex_unlock;
} }
@ -632,7 +632,6 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
atomic_inc(&xrcd->usecnt); atomic_inc(&xrcd->usecnt);
} }
if (fd_file(f))
fdput(f); fdput(f);
mutex_unlock(&ibudev->xrcd_tree_mutex); mutex_unlock(&ibudev->xrcd_tree_mutex);
@ -648,7 +647,6 @@ err:
uobj_alloc_abort(&obj->uobject, attrs); uobj_alloc_abort(&obj->uobject, attrs);
err_tree_mutex_unlock: err_tree_mutex_unlock:
if (fd_file(f))
fdput(f); fdput(f);
mutex_unlock(&ibudev->xrcd_tree_mutex); mutex_unlock(&ibudev->xrcd_tree_mutex);

View File

@ -234,7 +234,7 @@ const volatile void * __must_check_fn(const volatile void *val)
* DEFINE_CLASS(fdget, struct fd, fdput(_T), fdget(fd), int fd) * DEFINE_CLASS(fdget, struct fd, fdput(_T), fdget(fd), int fd)
* *
* CLASS(fdget, f)(fd); * CLASS(fdget, f)(fd);
* if (!fd_file(f)) * if (fd_empty(f))
* return -EBADF; * return -EBADF;
* *
* // use 'f' without concern * // use 'f' without concern

View File

@ -2250,7 +2250,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
bool nonatomic = substream->pcm->nonatomic; bool nonatomic = substream->pcm->nonatomic;
CLASS(fd, f)(fd); CLASS(fd, f)(fd);
if (!fd_file(f)) if (fd_empty(f))
return -EBADFD; return -EBADFD;
if (!is_pcm_file(fd_file(f))) if (!is_pcm_file(fd_file(f)))
return -EBADFD; return -EBADFD;