coresight: release reference taken by 'bus_find_device()'
authorMathieu Poirier <mathieu.poirier@linaro.org>
Tue, 2 Feb 2016 21:13:58 +0000 (14:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 06:11:10 +0000 (22:11 -0800)
The reference count taken by function bus_find_device() needs
to be released if a child device is found, something this patch
is adding.

Reported-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight.c

index 8872db4410ebf5b38dbfcf21eb84b01d3fd6a746..a35ca54a76c91a71f4737d410381c79aec5bcc3b 100644 (file)
@@ -570,6 +570,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev)
 
                if (dev) {
                        conn->child_dev = to_coresight_device(dev);
+                       /* and put reference from 'bus_find_device()' */
+                       put_device(dev);
                } else {
                        csdev->orphan = true;
                        conn->child_dev = NULL;