From owner-svn-src-head@freebsd.org Fri Nov 3 13:43:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0A50E529E6; Fri, 3 Nov 2017 13:43:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA8CE650D4; Fri, 3 Nov 2017 13:43:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA3Dh5BQ068387; Fri, 3 Nov 2017 13:43:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA3Dh5KR068386; Fri, 3 Nov 2017 13:43:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711031343.vA3Dh5KR068386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 3 Nov 2017 13:43:05 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 325360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Nov 2017 13:43:06 -0000 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;