Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1651903

Re: [PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free()

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free()
Date 2017-05-27 17:50 +0200
Message-ID <tLM8x-5Sc-15@gated-at.bofh.it> (permalink)
References <tLq81-87A-5@gated-at.bofh.it> <tLq83-87A-69@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free() Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-05-26 18:20 +0200
  Re: [PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-27 17:50 +0200
    Re: [PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free() Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-05-28 10:20 +0200
      Re: [PATCH v2 07/27] thunderbolt: Allow passing NULL to  tb_ctl_free() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-29 14:20 +0200

csiph-web