diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2017-06-06 08:24:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-09 05:42:41 -0400 |
commit | c9843ebbb83a120094aa3a55bc0190d285e8384a (patch) | |
tree | d296156a193479e70f2f14c366105c602c767f39 /drivers/thunderbolt | |
parent | da2da04b8d4476a411feb2a12b47792aebbc142f (diff) |
thunderbolt: Allow passing NULL to tb_ctl_free()
Following the usual pattern used in many places, we allow passing NULL
pointer to tb_ctl_free(). Then the user can call the function regardless
if it has allocated control channel or not making the code bit simpler.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r-- | drivers/thunderbolt/ctl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c index 889a32dd21e7..f8290a577b2b 100644 --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c | |||
@@ -520,6 +520,10 @@ err: | |||
520 | void tb_ctl_free(struct tb_ctl *ctl) | 520 | void tb_ctl_free(struct tb_ctl *ctl) |
521 | { | 521 | { |
522 | int i; | 522 | int i; |
523 | |||
524 | if (!ctl) | ||
525 | return; | ||
526 | |||
523 | if (ctl->rx) | 527 | if (ctl->rx) |
524 | ring_free(ctl->rx); | 528 | ring_free(ctl->rx); |
525 | if (ctl->tx) | 529 | if (ctl->tx) |