diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index baa94e54d20f..23e3b6cf98ec 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -101,18 +101,15 @@ isp_role_sysctl(SYSCTL_HANDLER_ARGS) ISP_LOCK(isp); old = FCPARAM(isp, chan)->role; + /* We don't allow target mode switch from here. */ + value = (old & ISP_ROLE_TARGET) | (value & ISP_ROLE_INITIATOR); + /* If nothing has changed -- we are done. */ if (value == old) { ISP_UNLOCK(isp); return (0); } - /* We don't allow target mode switch from here. */ - if ((value ^ old) & ISP_ROLE_TARGET) { - ISP_UNLOCK(isp); - return (EPERM); - } - /* Actually change the role. */ error = isp_control(isp, ISPCTL_CHANGE_ROLE, chan, value); ISP_UNLOCK(isp);