correct error handling.

from Ilja Van Sprundel, thanks.
This commit is contained in:
maya 2019-10-17 14:33:02 +00:00
parent ed6d73e306
commit e40e833ed6

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_dma_buf.c,v 1.5 2019/01/04 23:03:02 tnn Exp $ */ /* $NetBSD: linux_dma_buf.c,v 1.6 2019/10/17 14:33:02 maya Exp $ */
/*- /*-
* Copyright (c) 2018 The NetBSD Foundation, Inc. * Copyright (c) 2018 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_dma_buf.c,v 1.5 2019/01/04 23:03:02 tnn Exp $"); __KERNEL_RCSID(0, "$NetBSD: linux_dma_buf.c,v 1.6 2019/10/17 14:33:02 maya Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/atomic.h> #include <sys/atomic.h>
@ -133,11 +133,11 @@ dma_buf_get(int fd)
if ((file = fd_getfile(fd)) == NULL) { if ((file = fd_getfile(fd)) == NULL) {
error = EBADF; error = EBADF;
goto fail1; goto fail0;
} }
if (file->f_type != DTYPE_MISC || file->f_ops != &dmabuf_fileops) { if (file->f_type != DTYPE_MISC || file->f_ops != &dmabuf_fileops) {
error = EINVAL; error = EINVAL;
goto fail0; goto fail1;
} }
dmabuf = file->f_data; dmabuf = file->f_data;