The -EPROBE_DEFER error path in serial_base_device_init() is a bit
awkward. Before the call to device_initialize(dev) then we need to
manually release all the device resources. And after the call then we
need to call put_device() to release the resources. Doing either one
wrong will result in a leak or a use after free.
So let's wait to return -EPROBE_DEFER until after the call to
device_initialize(dev) so that way callers do not have to handle
-EPROBE_DEFER as a special case. Now callers can just use put_device()
for clean up.
The second issue with the -EPROBE_DEFER path is that deferring is not
supposed to be a fatal error, but instead it's normal part of the
init process and the kernel recovers from it automatically. That means
we should not print an error message but just a debug message on this
path.
Fixes:
|
||
|---|---|---|
| .. | ||
| hvc | ||
| ipwireless | ||
| serdev | ||
| serial | ||
| vt | ||
| Kconfig | ||
| Makefile | ||
| amiserial.c | ||
| ehv_bytechan.c | ||
| goldfish.c | ||
| mips_ejtag_fdc.c | ||
| moxa.c | ||
| mxser.c | ||
| n_gsm.c | ||
| n_hdlc.c | ||
| n_null.c | ||
| n_tty.c | ||
| nozomi.c | ||
| pty.c | ||
| rpmsg_tty.c | ||
| synclink_gt.c | ||
| sysrq.c | ||
| tty.h | ||
| tty_audit.c | ||
| tty_baudrate.c | ||
| tty_buffer.c | ||
| tty_io.c | ||
| tty_ioctl.c | ||
| tty_jobctrl.c | ||
| tty_ldisc.c | ||
| tty_ldsem.c | ||
| tty_mutex.c | ||
| tty_port.c | ||
| ttynull.c | ||
| vcc.c | ||