Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6/
[firefly-linux-kernel-4.4.55.git] / drivers / char / tty_ioctl.c
index 58597993954f7e8fea638d065afdc7a5362e2ed5..f19cf9d7792d57816b53cf0e697bda80fe07a50e 100644 (file)
@@ -476,11 +476,11 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
                        ld = tty_ldisc_ref(tty);
                        switch (arg) {
                        case TCIFLUSH:
-                               if (ld->flush_buffer)
+                               if (ld && ld->flush_buffer)
                                        ld->flush_buffer(tty);
                                break;
                        case TCIOFLUSH:
-                               if (ld->flush_buffer)
+                               if (ld && ld->flush_buffer)
                                        ld->flush_buffer(tty);
                                /* fall through */
                        case TCOFLUSH: