Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp215528pxx; Mon, 26 Oct 2020 07:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZT1VIhHuJW/yIRBlirfZPi5K3JiGNhPAiM12k8xzn1/uUsqpqmtPYBZmhprV5PhSAcM+R X-Received: by 2002:a17:906:4a8d:: with SMTP id x13mr16332856eju.47.1603721077287; Mon, 26 Oct 2020 07:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603721077; cv=none; d=google.com; s=arc-20160816; b=wYe/LKc/e7mvAOhox1o/M4csy/XkbWIR/cDJADpQUk8YNxkm8MSzkreK1w8FZuLnw+ /LYk0PGZbLQBGvVLcmPJjDBYr+Yn/gsT6LadRvxpvDGe/rsBZtWoesuwGMiqNdSi7S+p 0sGsiB9WVuEusjvzhv4056naFmBKm9mc0Bg9xNd2LjCQSK6BwxNzVjl8xmJKpoQDUtVM IwehHdJ6chmUPolH1qHAwGX+i3AYZTtp0aA2+qoCAzbtdGHevqRV6s/rCrPmc6Z/XLVL oqnBXUMhCEU9uqT2yOSN1iP1kT7qrJmUqKS6e+swEt9lEIxSzO3qkb10MJ8q8qcnz59q NILg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CjmXhl5JLo4J/PxFbte5j14dKUd6PJral95QAT5RzjQ=; b=B3JdkerfniRQJLZOo2NQQqj7Mv3CLYY2xg47bx7xrsKMDN1En+5GIilXtXqFoocVvo 4ECfSyPlnWN/p/MvyuTO/Fj7iITQa3gC70akNQLBumURkxmu+L2pG/CfInjRBNRe5IkU YfpEQsy/GCYstIvW8p/rOu56ChHIlIo6eK4fKFor8m279StJvCccklUGlrw6juGATOlJ EtnJWmkOSV7R2r4B6+wPyp4YxdmajphmampIqa7KygWXqUGHlmfL39YeDF065E2bFXDK XzT/hMJYvoEQY4GieYv+G6U4vfDUvJJm/D+tsBRn/jbC90WAILNQf17VH7zibYyAZwrW jD+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=AE5uYd3q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be17si7067860edb.35.2020.10.26.07.04.14; Mon, 26 Oct 2020 07:04:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=AE5uYd3q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1780242AbgJZNgc (ORCPT + 99 others); Mon, 26 Oct 2020 09:36:32 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:52674 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1775648AbgJZNg0 (ORCPT ); Mon, 26 Oct 2020 09:36:26 -0400 Received: by mail-wm1-f65.google.com with SMTP id c194so11678094wme.2 for ; Mon, 26 Oct 2020 06:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CjmXhl5JLo4J/PxFbte5j14dKUd6PJral95QAT5RzjQ=; b=AE5uYd3q/mN+YF+UoNFzyWfn2e6aNplcHY2J7LSmHYbHDV+AteEfF4NyzxqqRYZoBc n/H3yCCMtcPvc+nEf7l1mv8FXlr1u6Z4ulvrO6bNG5QpWlJOX47vTf9rnpKY9axYH6n2 Lzlc+XzrljZQ7kifz3e3pRSUIOy6S64I4iKJuRFuQNVTB/yLAIgOUqIc7ZB6+jmZZmYU GrFyTr66j9EF9wpV0uVqawEulSwlRpU4G8o2LU0rE1udCvyx0DV1kIEjDiG0YhykpLEd 4F4QKwsvlMIPm5ZU6OuSE8ElztOAfmqCVI07OgFG+S66sRWCr4pILeNQf+AedtxFXQZF uQ7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CjmXhl5JLo4J/PxFbte5j14dKUd6PJral95QAT5RzjQ=; b=o+qmI4CWu27h4FjCo8DaHqLuXo0UocbfPM40v0dCwJ1CyAFI/2yeadeusug0dfwFY8 rR7W6veJIol6x/WrAb1dCRDX491NpaIH3CKCO0HnBgCIFTkbxblI4jEljdpXuChrqFgZ ZSzOq/NGZVU54mZs+echOexLy7XPebwohNJSnvSBsYuNJAi2oCjpxmQFRDupYfxxTzCt Ll/amZtVnwmbxf0fiz3WwY3UrYkztRJXtxUXyg2ZyvDeN1ZsfOzyGv9msBXz2s17ac4X IlvYlMdaaN/Vje6eIz41vvmJRIfsJ2XC7zPZDk4Td+Fw6/ZywxaZVeXYldOczEccdCas HwKA== X-Gm-Message-State: AOAM533BNH9DFtvk27o3PC9+bmPPH+ZHr+uWgfbWkD6sX3cLXVxNQtY9 zctNXcaRtWmZqFHdLG0Jh7toDw== X-Received: by 2002:a1c:48c3:: with SMTP id v186mr17231235wma.16.1603719383782; Mon, 26 Oct 2020 06:36:23 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-190-206.w2-15.abo.wanadoo.fr. [2.15.39.206]) by smtp.gmail.com with ESMTPSA id f7sm23688991wrx.64.2020.10.26.06.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Oct 2020 06:36:23 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald-Stadler , Michal Simek Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 2/5] iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc() Date: Mon, 26 Oct 2020 14:36:06 +0100 Message-Id: <20201026133609.24262-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201026133609.24262-1-brgl@bgdev.pl> References: <20201026133609.24262-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski We now have devm_krealloc() in the kernel Use it indstead of calling kfree() and kcalloc() separately. Signed-off-by: Bartosz Golaszewski --- drivers/iio/adc/xilinx-xadc-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index 8494eb424b33..b516280ccbd4 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c @@ -589,8 +589,9 @@ static int xadc_update_scan_mode(struct iio_dev *indio_dev, n = bitmap_weight(mask, indio_dev->masklength); - kfree(xadc->data); - xadc->data = kcalloc(n, sizeof(*xadc->data), GFP_KERNEL); + xadc->data = devm_krealloc(indio_dev->dev.parent, xadc->data, + n * sizeof(*xadc->data), + GFP_KERNEL | __GFP_ZERO); if (!xadc->data) return -ENOMEM; @@ -1372,7 +1373,6 @@ static int xadc_remove(struct platform_device *pdev) free_irq(xadc->irq, indio_dev); cancel_delayed_work_sync(&xadc->zynq_unmask_work); clk_disable_unprepare(xadc->clk); - kfree(xadc->data); return 0; } -- 2.29.1