OSDN Git Service

drivers/w1/w1_int.c: call put_device if device_register fails
authorLevente Kurusa <levex@linux.com>
Tue, 22 Sep 2015 23:04:42 +0000 (09:04 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 25 Sep 2015 04:18:21 +0000 (14:18 +1000)
commite60b43dd52196745e35c952a61320c8ac62fd516
treec225bdc86c569c1c647ba0927dc80917cda3b5a1
parent62e3b76ea705a5ee00de5e02eccd1de1428db8e8
drivers/w1/w1_int.c: call put_device if device_register fails

Currently, memsetting and kfreeing the device is bad behaviour.  The
device will have a reference count of 1 and hence can cause trouble
because it has kfree'd.  Proper way to handle a failed device_register is
to call put_device right after it fails.

Signed-off-by: Levente Kurusa <levex@linux.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/w1/w1_int.c