]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit - drivers/w1/w1_int.c
drivers/w1/w1_int.c: call put_device if device_register fails
authorLevente Kurusa <levex@linux.com>
Mon, 14 Sep 2015 17:56:12 +0000 (10:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Oct 2015 03:47:09 +0000 (04:47 +0100)
commit5052436dcb7eac532cf2ffd6650be01d3f15e0b5
tree87ac7ae4040bf709aa7cd1f1d67b078293304e21
parent7c22e645cd742b82ec232e4f2328fc53d247ccea
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/w1_int.c