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 1B0D6C6FD1C for ; Mon, 13 Mar 2023 14:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbjCMOST (ORCPT ); Mon, 13 Mar 2023 10:18:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231318AbjCMOSK (ORCPT ); Mon, 13 Mar 2023 10:18:10 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7086EBBBD; Mon, 13 Mar 2023 07:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678717077; x=1710253077; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vnCVt+wdWALDJ5asvXR3HRX+LKXTlmdftdrQVlu2wDw=; b=jEyZw3xt5g1heQ3eiRU+N5H6UanZPziyfDhZOaG4cjJU6nb90zW6Sm+N OCNxTavZKzudTY8QNblDoRxOy5YugGSBlwyStp8303qHlevM5xGUkM4Vo KtlpOmXi1HfQMIFN3QjMOBtyyRwzA4xZKfX0HpnpfXe1LoIWOmezX872L xx3mDkkaD5CoO+9vgAqk456rKB1Pz+xzl/eM5n+HFZGSGHsTUc+9kbrtN UVIAKCPWl4C2QkJHfDZ865QVzIGDkETW+Zou6h2HtDq2doXO0FmrfmJGG zY9GALTYhFDX/2jWAcbcGCxudJnJDf+5HV0zJbMnpDuT33WTje5N/AUrN Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="423423944" X-IronPort-AV: E=Sophos;i="5.98,257,1673942400"; d="scan'208";a="423423944" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 07:17:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="821988528" X-IronPort-AV: E=Sophos;i="5.98,257,1673942400"; d="scan'208";a="821988528" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001.fm.intel.com with ESMTP; 13 Mar 2023 07:17:54 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pbizo-002fW4-1b; Mon, 13 Mar 2023 16:17:52 +0200 Date: Mon, 13 Mar 2023 16:17:52 +0200 From: Andy Shevchenko To: Matti Vaittinen Cc: Matti Vaittinen , Jonathan Cameron , Lars-Peter Clausen , Shreeya Patel , Paul Gazzillo , Dmitry Osipenko , Zhigang Shi , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: Re: [PATCH v3 2/6] iio: light: Add gain-time-scale helpers Message-ID: References: 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-kernel@vger.kernel.org On Mon, Mar 13, 2023 at 03:59:03PM +0200, Matti Vaittinen wrote: > On 3/13/23 15:25, Andy Shevchenko wrote: > > On Mon, Mar 13, 2023 at 02:47:45PM +0200, Matti Vaittinen wrote: > > > On 3/6/23 14:52, Andy Shevchenko wrote: > > > > On Mon, Mar 06, 2023 at 11:17:15AM +0200, Matti Vaittinen wrote: ... > > > > > + if (ret && gts->avail_all_scales_table) > > > > > > > > In one case you commented that free(NULL) is okay, in the other, you add > > > > a duplicative check. Why? > > > > > > Sorry but what do you mean by dublicative check? > > > > > > Usually I avoid the kfree(NULL). That's why I commented on it in that > > > another case where it was not explicitly disallowed. I'll change that for v4 > > > to avoid kfree(NULL) as you suggested. > > > > So, and with it you put now a double check for NULL, do you think it's okay? > > I don't. > > I don't see the double check. I see only one check just above the kfree()? > Where is the other check? if (... gts->avail_all_scales_table) is a double to one, which is inside kfree(). I.o.w. kfree() is NULL-aware and you know that. > > > > > + kfree(gts->avail_all_scales_table); -- With Best Regards, Andy Shevchenko