From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0103C5479D for ; Mon, 9 Jan 2023 11:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233468AbjAILbB (ORCPT ); Mon, 9 Jan 2023 06:31:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234085AbjAILae (ORCPT ); Mon, 9 Jan 2023 06:30:34 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E427186FB for ; Mon, 9 Jan 2023 03:30:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673263833; x=1704799833; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=hR/T0atKpYHFL9STSk8XB/uMnDh3gNZjZSbQwJEN3AY=; b=Oc4vzpWEn2r9AmkICgMGfjuqSNDd6lzTZFucjmecesIB2GA3vSWkbohq qQGZGbYixzQttRkL4xKFIgh6xk1gudaV/MqPEuorBF+CXnPTGjSDSuWSy 7TE3iQOOWY+dBsLg9yqGuuGddCuvUVlwLSLka04XgMk05x8qkj7+bOQk1 LAcNeL8GHWoHFLFidRW/buaIR7gZ8XfBC5V6epWs3zay/WT3kGOMtcenw Mgjz/Vtazjq1sdqCXkuIa3povqTh0XW1WfeioM7vPUsAM/aSDK24+45Kt YhKMSxGweAUi60VybXaHvIYXJwq4ErCH86FlOnElRl0NYwv5Y4hGItcqM g==; X-IronPort-AV: E=McAfee;i="6500,9779,10584"; a="306370628" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="306370628" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2023 03:30:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10584"; a="606579780" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="606579780" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP; 09 Jan 2023 03:30:30 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pEqMH-006MiC-0k; Mon, 09 Jan 2023 13:30:29 +0200 Date: Mon, 9 Jan 2023 13:30:28 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Kent Gibson , Linus Walleij , Viresh Kumar , linux-gpio@vger.kernel.org, Bartosz Golaszewski Subject: Re: [libgpiod][PATCH] core: make the library NULL-aware Message-ID: References: <20230106115129.393007-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Mon, Jan 09, 2023 at 01:29:37PM +0200, Andy Shevchenko wrote: > On Fri, Jan 06, 2023 at 12:51:29PM +0100, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski ... > > GPIOD_API void gpiod_line_config_free(struct gpiod_line_config *config) > > { > > + if (!config) > > + return; > > + > > free_refs(config); > > free(config); > > } > > At least this is redundant. free() is NULL-aware itself. And if free_refs() is not, it's better to make it explicit or fix that function if possible. -- With Best Regards, Andy Shevchenko