Colin Ian King 704a940d55 thunderbolt: fix memory leak of object sw
In the case where the call tb_switch_exceeds_max_depth is true
the error reurn path leaks memory in sw.  Fix this by setting
the return error code to -EADDRNOTAVAIL and returning via the
error exit path err_free_sw_ports to free sw. sw has been kzalloc'd
so the free of the NULL sw->ports is fine.

Addresses-Coverity: ("Resource leak")
Fixes: b04079837b20 ("thunderbolt: Add initial support for USB4")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20191220220526.11307-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-14 15:37:41 +01:00
..
2020-01-03 12:11:30 -08:00
2019-12-01 18:43:25 -08:00
2019-11-30 14:35:43 -08:00
2019-12-01 18:42:02 -08:00
2019-12-13 14:27:19 -08:00
2020-01-04 10:41:08 -08:00
2019-12-06 08:28:51 -08:00
2019-12-03 13:58:22 -08:00
2019-12-03 14:37:12 -08:00
2019-12-21 06:17:05 -08:00
2020-01-13 12:11:40 +01:00
2019-12-01 18:43:25 -08:00
2019-12-05 11:43:31 -08:00
2019-11-25 19:40:40 -08:00
2020-01-13 12:11:40 +01:00
2020-01-04 14:16:57 -08:00
2019-12-05 11:28:14 -08:00
2020-01-06 12:04:31 -08:00
2019-12-01 18:39:24 -08:00
2019-12-27 17:28:41 -08:00
2020-01-06 12:34:44 -08:00
2020-01-10 13:22:11 -08:00
2019-12-27 17:28:41 -08:00
2019-12-05 13:18:54 -08:00
2020-01-13 12:11:40 +01:00
2019-12-07 14:51:04 -08:00
2019-12-03 13:58:22 -08:00
2019-11-14 13:06:33 +08:00
2019-12-21 06:24:56 -08:00