Re: [PATCH] tty: add Moxa Smartio MUE serial driver

From: kbuild test robot
Date: Sun Feb 07 2016 - 03:34:17 EST


Hi Mathieu,

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v4.5-rc2 next-20160205]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url: https://github.com/0day-ci/linux/commits/Mathieu-OTHACEHE/tty-add-Moxa-Smartio-MUE-serial-driver/20160202-043752
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: ia64-allmodconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64

All errors (new ones prefixed by >>):

drivers/tty/mxupcie.c: In function 'mxupcie_get_serial_info':
>> drivers/tty/mxupcie.c:803:2: error: implicit declaration of function 'copy_to_user' [-Werror=implicit-function-declaration]
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
^
drivers/tty/mxupcie.c: In function 'mxupcie_set_serial_info':
>> drivers/tty/mxupcie.c:822:2: error: implicit declaration of function 'copy_from_user' [-Werror=implicit-function-declaration]
if (copy_from_user(&new_serial, new_info, sizeof(new_serial)))
^
drivers/tty/mxupcie.c: In function 'mxupcie_get_lsr_info':
>> drivers/tty/mxupcie.c:897:2: error: implicit declaration of function 'put_user' [-Werror=implicit-function-declaration]
put_user(result, value);
^
cc1: some warnings being treated as errors

vim +/copy_to_user +803 drivers/tty/mxupcie.c

797 tmp.baud_base = info->baud_base;
798 tmp.close_delay = info->close_delay;
799 tmp.closing_wait = info->closing_wait;
800 tmp.custom_divisor = info->custom_divisor;
801 tmp.hub6 = 0;
802
> 803 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
804 return -EFAULT;
805
806 return 0;
807 }
808
809 static int mxupcie_set_serial_info(struct tty_struct *tty,
810 struct serial_struct *new_info)
811 {
812 struct mxupcie_port *info = tty->driver_data;
813 struct tty_port *port = &info->port;
814 struct serial_struct new_serial;
815 unsigned int flags;
816 int retval = 0;
817 unsigned long sp_flags;
818
819 if (!new_info)
820 return -EFAULT;
821
> 822 if (copy_from_user(&new_serial, new_info, sizeof(new_serial)))
823 return -EFAULT;
824
825 if ((new_serial.irq != info->board->irq) ||
826 (new_serial.port != *info->ioaddr))
827 return -EINVAL;
828
829 flags = port->flags & ASYNC_SPD_MASK;
830
831 if (!capable(CAP_SYS_ADMIN)) {
832 if ((new_serial.baud_base != info->baud_base) ||
833 (new_serial.close_delay != info->close_delay) ||
834 ((new_serial.flags & ~ASYNC_USR_MASK) !=
835 (port->flags & ~ASYNC_USR_MASK)))
836 return -EPERM;
837
838 port->flags = ((port->flags & ~ASYNC_USR_MASK) |
839 (new_serial.flags & ASYNC_USR_MASK));
840 } else {
841 /*
842 * OK, past this point, all the error checking has been done.
843 * At this point, we start making changes.....
844 */
845 port->flags = ((port->flags & ~ASYNC_FLAGS) |
846 (new_serial.flags & ASYNC_FLAGS));
847 info->close_delay = new_serial.close_delay * HZ / 100;
848 info->closing_wait = new_serial.closing_wait * HZ / 100;
849
850 if ((new_serial.baud_base != info->baud_base) ||
851 (new_serial.custom_divisor != info->custom_divisor)) {
852
853 if (new_serial.custom_divisor == 0)
854 return -EINVAL;
855
856 info->custom_baud_rate = new_serial.baud_base /
857 new_serial.custom_divisor;
858 }
859 }
860
861 if (test_bit(ASYNCB_INITIALIZED, &port->flags)) {
862 if (flags != (port->flags & ASYNC_SPD_MASK)) {
863 spin_lock_irqsave(&info->slock, sp_flags);
864 mxupcie_change_speed(tty, NULL);
865 spin_unlock_irqrestore(&info->slock, sp_flags);
866 }
867 } else {
868 retval = mxupcie_activate(port, tty);
869 if (retval == 0)
870 set_bit(ASYNCB_INITIALIZED, &port->flags);
871 }
872
873 return retval;
874 }
875
876 /*
877 * mx_get_lsr_info - get line status register info
878 *
879 * Purpose: Let user call ioctl() to get info when the UART physically
880 * is emptied. On bus types like RS485, the transmitter must
881 * release the bus after transmitting. This must be done when
882 * the transmit shift register is empty, not be done when the
883 * transmit holding register is empty. This functionality
884 * allows an RS485 driver to be written in user space.
885 */
886 static int mxupcie_get_lsr_info(struct tty_struct *tty, unsigned int *value)
887 {
888 struct mxupcie_port *info = tty->driver_data;
889 unsigned char status;
890 unsigned int result;
891 unsigned long sp_flags;
892
893 spin_lock_irqsave(&info->slock, sp_flags);
894 status = ioread8(info->ioaddr + UART_LSR);
895 spin_unlock_irqrestore(&info->slock, sp_flags);
896 result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0);
> 897 put_user(result, value);
898
899 return 0;
900 }

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data