From patchwork Mon Oct 9 13:26:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 115228 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2562021qgn; Mon, 9 Oct 2017 06:30:31 -0700 (PDT) X-Received: by 10.84.233.70 with SMTP id k6mr2130453plt.134.1507555831299; Mon, 09 Oct 2017 06:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507555831; cv=none; d=google.com; s=arc-20160816; b=k0B0UHoixIv3q4uOMfJCu7PtlQl1dsHV6THcUN9DfbePQcb1VRONp8j5HTGj92dJun cwOWQK0uR3hPPgbcN5/xocg6mu9E7FWL/7UPjkI/4+6e/6qGJBKDrQEHVydEveyUj5eI TS8LjMwHceijeeewr7iAjvX2amD7Sme7WV3OCOOebvRxK9IQ6AiwQY7Pt2pPwfc9RPxE NwMwnc3898t56g3Qq6XIAL/DgD9a7gpfmHl4xBaHtjAfDR82FfRpR5mq9V13Zzrve6xl UxI+C3SAglcrrpOVOhg6l8cotzFsAPU3RVFBU7KUD/6ACf3r0mgRdVHJVJolwv1ohOpZ caMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TEky1py+uh8A+8Vus2+2O72KeL6FEWP3YZJc2PcVjMk=; b=gLhAbCu6oR7U5t/YqFbeLmM3tWbF7RQqnEZUWqJFHhXkYpOJmVKJKcrpqxOt80swEQ 5LhHlGEkcgx1XT6EYnIl/ClAjvYxZ4jK/55VBPy0VM7O4Zr3Wi9OQyQEhf9PlE88hH8Z F1i4BYp3fx1dvcvbZ6uIFCiQTVPjsCXnApXJJKi6cz5kvmWhzSSdm20bL+TxDnyeI11k SuUTOj7pv243Ajg/obH/SLEL4JLSEXmc+12Vsd80Ir1nQbcruPa2Itas7ASm4ifc4SrU fAcypvhAdGMCXas/qIotXbz0FhJMb2c1xmzlLdM1hJ7zZ4x1THxe9pkB1IHrdmwRPcrF KZhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JCNvPdL+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e10si6371519pgp.718.2017.10.09.06.30.30; Mon, 09 Oct 2017 06:30:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JCNvPdL+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754532AbdJINa3 (ORCPT + 26 others); Mon, 9 Oct 2017 09:30:29 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:52468 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755309AbdJIN0x (ORCPT ); Mon, 9 Oct 2017 09:26:53 -0400 Received: by mail-wm0-f50.google.com with SMTP id k4so23476055wmc.1 for ; Mon, 09 Oct 2017 06:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TEky1py+uh8A+8Vus2+2O72KeL6FEWP3YZJc2PcVjMk=; b=JCNvPdL+kXWW19cFdNkJNpNXCD9CQVoiaxqgnJS9WudVgWUJ5j4CBOvr+aHk/M3wBX eeqoiUM9mczK/kgCVKY1+tWhb4a87TAD6kEgocRibTOgG1Fj+6ih6npqw+BLalH6cD3n Hm7nhqz+32j+1Nz3MuQeG1GID5IoPWQ9UlXUY= 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; bh=TEky1py+uh8A+8Vus2+2O72KeL6FEWP3YZJc2PcVjMk=; b=PZfdPhIUw+tEhA7HsVoZYbsrngBqeuOVZ7+ytyNM9unjmTrtcL5n2BTjPXNbXU7XSM WkQer++AaJwxzNkW+eLYtcp5keYpoRPS03vkMTR+r4tFSqbnOKgQFqbqpXLCnZN3v061 6ZPkQougI1tWc6ohybcmg/Hn2A3YA9Ki/HA1RjIGQtB+iTfC8BT/ZbMFtcKr2M6jVVht QBzjfVmEtUNNoDp1JFU5bL6ZU1GI8evf3Z+yckdABoeV/Bs97MqpwG+WRelHHS4uHs7v EGTiOCiqFanHC0jGfJhoJSn2qnwkYcL83xnX1HLMbomC42+ddyudc1ZvT0TTupMldn5W RJuw== X-Gm-Message-State: AMCzsaUIofR6uHX1E/J08TIfPoXYTua+oG8Lo/O9nEaQQ6oOMtDUpoc6 wFlQHWOB0EwMBqG/6DO7KUULbg== X-Google-Smtp-Source: AOwi7QBicURiCeG9B/w1BQAxgXC261HKjNFQ1aGrKayMy5uXVTaChUH7yBxpDWNuBnm9o/w80/FbDQ== X-Received: by 10.28.134.18 with SMTP id i18mr9592702wmd.27.1507555612177; Mon, 09 Oct 2017 06:26:52 -0700 (PDT) Received: from localhost.localdomain (static.8.26.4.46.clients.your-server.de. [46.4.26.8]) by smtp.gmail.com with ESMTPSA id 31sm3775340wrm.0.2017.10.09.06.26.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 06:26:51 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Masahiro Yamada Subject: [PATCH 02/12] nvmem: mtk-efuse: use stack for nvmem_config instead of malloc'ing it Date: Mon, 9 Oct 2017 15:26:31 +0200 Message-Id: <20171009132641.27169-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171009132641.27169-1-srinivas.kandagatla@linaro.org> References: <20171009132641.27169-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada nvmem_register() copies all the members of nvmem_config to nvmem_device. So, nvmem_config is one-time use data during probing. There is no point to keep it until the driver detach. Using stack should be no problem because nvmem_config is pretty small. Signed-off-by: Masahiro Yamada Acked-by: Sean Wang Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/mtk-efuse.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) -- 2.11.0 diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c index 32fd572e18c5..fa7a0f66b37e 100644 --- a/drivers/nvmem/mtk-efuse.c +++ b/drivers/nvmem/mtk-efuse.c @@ -49,7 +49,7 @@ static int mtk_efuse_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct resource *res; struct nvmem_device *nvmem; - struct nvmem_config *econfig; + struct nvmem_config econfig = {}; void __iomem *base; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -57,19 +57,15 @@ static int mtk_efuse_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - econfig = devm_kzalloc(dev, sizeof(*econfig), GFP_KERNEL); - if (!econfig) - return -ENOMEM; - - econfig->stride = 4; - econfig->word_size = 4; - econfig->reg_read = mtk_reg_read; - econfig->reg_write = mtk_reg_write; - econfig->size = resource_size(res); - econfig->priv = base; - econfig->dev = dev; - econfig->owner = THIS_MODULE; - nvmem = nvmem_register(econfig); + econfig.stride = 4; + econfig.word_size = 4; + econfig.reg_read = mtk_reg_read; + econfig.reg_write = mtk_reg_write; + econfig.size = resource_size(res); + econfig.priv = base; + econfig.dev = dev; + econfig.owner = THIS_MODULE; + nvmem = nvmem_register(&econfig); if (IS_ERR(nvmem)) return PTR_ERR(nvmem);