lkml.org 
[lkml]   [2017]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free()
On Fri, May 26, 2017 at 7:09 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> 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 as you mentioned in cover letter?

> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
> drivers/thunderbolt/ctl.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> 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 @@ struct tb_ctl *tb_ctl_alloc(struct tb_nhi *nhi, hotplug_cb cb, void *cb_data)
> void tb_ctl_free(struct tb_ctl *ctl)
> {
> int i;
> +
> + if (!ctl)
> + return;
> +
> if (ctl->rx)
> ring_free(ctl->rx);
> if (ctl->tx)
> --
> 2.11.0
>



--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2017-05-27 17:42    [W:2.972 / U:3.736 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site