2016-05-03 17:15 GMT+09:00 Dan Carpenter <dan.carpenter@xxxxxxxxxx>: > Hello Daeseok Youn, Hello Dan, > > 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. Yes, right. I had a mistake for handling error for print_driver. Error handling code will be moved after calling tty_alloc_driver(). > > 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 Thanks. regards, Daeseok Youn. _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel