staging: dgnc: use tty_alloc_driver instead of kcalloc

Dan Carpenter dan.carpenter at oracle.com
Tue May 3 08:15:08 UTC 2016


Hello Daeseok Youn,

The patch 60b3109e5e2d: "staging: dgnc: use tty_alloc_driver instead
of kcalloc" from Apr 14, 2016, leads to the following static checker
warning:

	drivers/staging/dgnc/dgnc_tty.c:229 dgnc_tty_register()
	error: 'brd->print_driver' dereferencing possible ERR_PTR()

drivers/staging/dgnc/dgnc_tty.c
   217          /*
   218           * If we're doing transparent print, we have to do all of the above
   219           * again, separately so we don't get the LD confused about what major
   220           * we are when we get into the dgnc_tty_open() routine.
   221           */
   222          brd->print_driver = tty_alloc_driver(brd->maxports,
   223                                               TTY_DRIVER_REAL_RAW |
   224                                               TTY_DRIVER_DYNAMIC_DEV |
   225                                               TTY_DRIVER_HARDWARE_BREAK);

This function call needs error handling.

   226  
   227          snprintf(brd->print_name, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum);
   228  
   229          brd->print_driver->name = brd->print_name;
   230          brd->print_driver->name_base = 0;
   231          brd->print_driver->major = brd->serial_driver->major;
   232          brd->print_driver->minor_start = 0x80;

regards,
dan carpenter


More information about the devel mailing list