From patchwork Wed Oct 13 09:49:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12555335 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 536CEC433F5 for ; Wed, 13 Oct 2021 09:50:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C19760F21 for ; Wed, 13 Oct 2021 09:50:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239322AbhJMJwF (ORCPT ); Wed, 13 Oct 2021 05:52:05 -0400 Received: from mga06.intel.com ([134.134.136.31]:23860 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239338AbhJMJvx (ORCPT ); Wed, 13 Oct 2021 05:51:53 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="288263458" X-IronPort-AV: E=Sophos;i="5.85,370,1624345200"; d="scan'208";a="288263458" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 02:49:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,370,1624345200"; d="scan'208";a="626271500" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 13 Oct 2021 02:49:18 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D7529367; Wed, 13 Oct 2021 12:49:25 +0300 (EEST) From: Andy Shevchenko To: Jonathan Cameron , Alexandru Ardelean , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen , Yang Yingliang , Andy Shevchenko Subject: [PATCH v2 0/2] iio: buffer: allocation and freeing buffers fix and optimization Date: Wed, 13 Oct 2021 12:49:21 +0300 Message-Id: <20211013094923.2473-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Yang submitted a fix, but I think the code can be refactored a bit to be more robust against similar mistakes in the future, if any. In v2: - put SoB Yang's patch (it's good for backporting) - added refactoring patch on top of Yang's fix Andy Shevchenko (1): iio: buffer: Use dedicated variable in iio_buffers_alloc_sysfs_and_mask() Yang Yingliang (1): iio: buffer: Fix double-free in iio_buffers_alloc_sysfs_and_mask() drivers/iio/industrialio-buffer.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)