Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Nov 2017 13:43:05 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325360 - head/sys/compat/linuxkpi/common/src
Message-ID:  <201711031343.vA3Dh5KR068386@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Nov  3 13:43:05 2017
New Revision: 325360
URL: https://svnweb.freebsd.org/changeset/base/325360

Log:
  Remove redundant dev->si_drv1 NULL checks in the LinuxKPI.
  This pointer is checked during the linux_dev_open() callback and does
  not need to be NULL checked again. It should always be set for
  character devices belonging to the "linuxcdevsw" and technically
  there is no need to NULL check this pointer at all.
  
  Suggested by:	kib @
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c	Fri Nov  3 13:42:04 2017	(r325359)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c	Fri Nov  3 13:43:05 2017	(r325360)
@@ -745,8 +745,6 @@ linux_dev_close(struct cdev *dev, int fflag, int devty
 	int error;
 
 	file = td->td_fpop;
-	if (dev->si_drv1 == NULL)
-		return (0);
 	if ((error = devfs_get_cdevpriv((void **)&filp)) != 0)
 		return (error);
 	filp->f_flags = file->f_flag;
@@ -879,8 +877,6 @@ linux_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t 
 	int error;
 
 	file = td->td_fpop;
-	if (dev->si_drv1 == NULL)
-		return (ENXIO);
 	if ((error = devfs_get_cdevpriv((void **)&filp)) != 0)
 		return (error);
 	filp->f_flags = file->f_flag;
@@ -948,8 +944,6 @@ linux_dev_read(struct cdev *dev, struct uio *uio, int 
 
 	td = curthread;
 	file = td->td_fpop;
-	if (dev->si_drv1 == NULL)
-		return (ENXIO);
 	if ((error = devfs_get_cdevpriv((void **)&filp)) != 0)
 		return (error);
 	filp->f_flags = file->f_flag;
@@ -990,8 +984,6 @@ linux_dev_write(struct cdev *dev, struct uio *uio, int
 
 	td = curthread;
 	file = td->td_fpop;
-	if (dev->si_drv1 == NULL)
-		return (ENXIO);
 	if ((error = devfs_get_cdevpriv((void **)&filp)) != 0)
 		return (error);
 	filp->f_flags = file->f_flag;
@@ -1030,8 +1022,6 @@ linux_dev_poll(struct cdev *dev, int events, struct th
 	struct file *file;
 	int revents;
 
-	if (dev->si_drv1 == NULL)
-		goto error;
 	if (devfs_get_cdevpriv((void **)&filp) != 0)
 		goto error;
 
@@ -1233,8 +1223,6 @@ linux_dev_kqfilter(struct cdev *dev, struct knote *kn)
 
 	td = curthread;
 	file = td->td_fpop;
-	if (dev->si_drv1 == NULL)
-		return (ENXIO);
 	if ((error = devfs_get_cdevpriv((void **)&filp)) != 0)
 		return (error);
 	filp->f_flags = file->f_flag;
@@ -1285,8 +1273,6 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *
 
 	td = curthread;
 	file = td->td_fpop;
-	if (dev->si_drv1 == NULL)
-		return (ENODEV);
 	if ((error = devfs_get_cdevpriv((void **)&filp)) != 0)
 		return (error);
 	filp->f_flags = file->f_flag;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711031343.vA3Dh5KR068386>