From: Mika Westerberg Date: Tue, 6 Jun 2017 12:24:59 +0000 (+0300) Subject: thunderbolt: Allow passing NULL to tb_ctl_free() X-Git-Tag: v4.14-rc1~620^2~82 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9843ebbb83a120094aa3a55bc0190d285e8384a;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Mika Westerberg Signed-off-by: Andreas Noever Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c index 889a32d..f8290a5 100644 --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c @@ -520,6 +520,10 @@ err: void tb_ctl_free(struct tb_ctl *ctl) { int i; + + if (!ctl) + return; + if (ctl->rx) ring_free(ctl->rx); if (ctl->tx)