From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751423AbdE0Plb (ORCPT ); Sat, 27 May 2017 11:41:31 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:34480 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbdE0Pl3 (ORCPT ); Sat, 27 May 2017 11:41:29 -0400 MIME-Version: 1.0 In-Reply-To: <20170526160936.54265-8-mika.westerberg@linux.intel.com> References: <20170526160936.54265-1-mika.westerberg@linux.intel.com> <20170526160936.54265-8-mika.westerberg@linux.intel.com> From: Andy Shevchenko Date: Sat, 27 May 2017 18:41:28 +0300 Message-ID: Subject: Re: [PATCH v2 07/27] thunderbolt: Allow passing NULL to tb_ctl_free() To: Mika Westerberg Cc: Greg Kroah-Hartman , Andreas Noever , Michael Jamet , Yehezkel Bernat , Lukas Wunner , Amir Levy , Andy Lutomirski , Mario Limonciello , Jared.Dominguez@dell.com, Andy Shevchenko , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 26, 2017 at 7:09 PM, Mika Westerberg 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 > --- > 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