tty_register_driver: only allocate tty instances when defined
authorAndy Whitcroft <apw@shadowen.org>
Sun, 6 May 2007 21:49:33 +0000 (14:49 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 7 May 2007 19:12:53 +0000 (12:12 -0700)
commit543691a6cd70b606dd9bed5e77b120c5d9c5c506
tree91d1033d6699e28393c7a2cae63727ac22db92ac
parentb5637e65ee2cecd344b1f8ff750013f697d3ae16
tty_register_driver: only allocate tty instances when defined

If device->num is zero we attempt to kmalloc() zero bytes.  When SLUB is
enabled this returns a null pointer and take that as an allocation failure
and fail the device register.  Check for no devices and avoid the
allocation.

[akpm: opportunistic kzalloc() conversion]
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/tty_io.c