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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to