Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1651504 > unrolled thread
| Started by | Mika Westerberg <mika.westerberg@linux.intel.com> |
|---|---|
| First post | 2017-05-26 18:20 +0200 |
| Last post | 2017-05-29 14:20 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[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
| From | Mika Westerberg <mika.westerberg@linux.intel.com> |
|---|---|
| Date | 2017-05-26 18:20 +0200 |
| Subject | [PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free() |
| Message-ID | <tLq83-87A-69@gated-at.bofh.it> |
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.
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
[toc] | [next] | [standalone]
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Date | 2017-05-27 17:50 +0200 |
| Message-ID | <tLM8x-5Sc-15@gated-at.bofh.it> |
| In reply to | #1651504 |
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
[toc] | [prev] | [next] | [standalone]
| From | Mika Westerberg <mika.westerberg@linux.intel.com> |
|---|---|
| Date | 2017-05-28 10:20 +0200 |
| Message-ID | <tM1AB-7P8-3@gated-at.bofh.it> |
| In reply to | #1651903 |
On Sat, May 27, 2017 at 06:41:28PM +0300, Andy Shevchenko wrote: > 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? OK, I'll add it. BTW, should I do it for the other patch that was suggested by Andreas as well?
[toc] | [prev] | [next] | [standalone]
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| Date | 2017-05-29 14:20 +0200 |
| Subject | Re: [PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free() |
| Message-ID | <tMrOp-8a6-5@gated-at.bofh.it> |
| In reply to | #1652056 |
On Sun, 2017-05-28 at 11:13 +0300, Mika Westerberg wrote: > On Sat, May 27, 2017 at 06:41:28PM +0300, Andy Shevchenko wrote: > > 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? > > OK, I'll add it. > > BTW, should I do it for the other patch that was suggested by Andreas > as > well? Sure -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web