From patchwork Fri Sep 27 08:27:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 174606 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3180509ill; Fri, 27 Sep 2019 01:28:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfS6ehhGilYD0jcUzLbzUH+yoppp5CWJg8nHw2ChC+UhMsZGdKOc2KSSkN0uNSeR7ZhFeC X-Received: by 2002:a50:f19c:: with SMTP id x28mr3114801edl.42.1569572896829; Fri, 27 Sep 2019 01:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569572896; cv=none; d=google.com; s=arc-20160816; b=VgqHRDjhpblHzIRJ4yGg9nANv+wgRn2Ci4J6zzaBEhecJgBvwrJrIZUQqU22Ghfpex j/VjJR/1YQ2uUSwwB5pNZWIeSd1ye3XWxPVipMrpY+Gj7nAiBCZ03zBvcGys4zANhGlA ULEHgsUmtAPpnYF7uxsxSaorbQZqNrIR90dotFXyJ/xHR9ZrdIo0uZa61ryZsq58yRYs ACTcCDH9PLZt9sRkulrYzMP/5z4XtdKX24toR3SGE3+h4kCpQf1ohPgq99STqjwAp76f Wl1mhRvcnBe3hPAavdAM4Zu/gsI3dvIlGOCdjKsr2cxQCECE2VvOBN3rW53Rrfx3Dfsk sqAA== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=vfYzArXzFe1wH00PAKP88fvUR7yXk6kDogWfZQY7lTA=; b=dPywu8HDnBefowSujbIZuR54YlTdE2XENQNxDOUD8E347Ay36QFhc7XZSM7/qOVqsP Ju9nO9RhsArVEbej2KXWlMMzq0p94rvceneaHBI0UBZ+Xf0v56nGrJs56WsKBfWV/IHX K2PicwIfMEEAYeW8JES7W5OQoyx2NvZYM4A8pwPPeC5UlHLgYiFi7QR4IH5iEbqC6X85 2psXRuyJj7xo4JM1QqPYAvrBo+hPJPGq/MAxupNbhT3gnD+FLnara09GxsmUdlQj3iWP aWdhVW4YzYbbQ3tQTSDKmx9Kaw/GCYWLbqyG/EYzUQMlKMGJcBLJHdEJU5jrJixxP/k0 cEVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S02hsAii; 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 u12si1131867edi.326.2019.09.27.01.28.16; Fri, 27 Sep 2019 01:28:16 -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=S02hsAii; 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 S1727134AbfI0I2P (ORCPT + 26 others); Fri, 27 Sep 2019 04:28:15 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:39831 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726730AbfI0I2O (ORCPT ); Fri, 27 Sep 2019 04:28:14 -0400 Received: by mail-pl1-f194.google.com with SMTP id s17so785645plp.6 for ; Fri, 27 Sep 2019 01:28:12 -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 :in-reply-to:references; bh=vfYzArXzFe1wH00PAKP88fvUR7yXk6kDogWfZQY7lTA=; b=S02hsAiiBDCmqzupGtJrjHkn9YV7Qk3fVrnsTFaEf6sC720aQY4Ev4M3phUHhoyUXI MhS3KIWNqIFoSEZ9lich9pbh8HtVr4OLUMuElnij8iezvsPEczpf/K0iQkU8Rp0xhYh5 81WPorMjBDzY30Bgf2aP14iEX6X+yCxfFuQETJoCQMyMEbl4b3XtP3NLTTHhC03+22H4 NXavZm7TMJ78BSG5rSUAA9EKWUY6hxC9cPrjWoPmOyhYiKrgNYMQlfMV5DdZ9LAXPJvi 9uuwzaRwlXD7Hc6rxLtLbGrzvMXmk+xrHc2BnfMn4hsODscVzEOaYAN5Q8di/h0WpLop LHEQ== 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:in-reply-to:references; bh=vfYzArXzFe1wH00PAKP88fvUR7yXk6kDogWfZQY7lTA=; b=akWEQxcnP9STGKVj4pQd2D2FE8VVAQHAg6N+qcFVHzX9vDkSgW4jQlp1QJ9/vRoYSN aTk4U1ZfhaVdso56eZY5XusvP44HPyi+mEEAaJ04NPxRYR1sCbooAsZg68CcUn1dMQxr x/l3Z01Vi8pr2UBfw2FEagesvZrknWVGzYZOsZ37MVAGFhdtoSjN+70S2Eo+FfHc4fjb OdGnvKst6E52gSAQA+uJBFhTswn/I7gLpq6rDhOOpZQnE1GL22K1GRXGyOCpEXYBeIET zysNKOUDi2Nzlzdext42srhsjJjuLOzx4gYB04by9IgjeEE0/Xr/Q0l5tMGreBHc0QfH 7DBg== X-Gm-Message-State: APjAAAXKv90116Y/7h5k0vq9kum81me4GneiTTo0XuqzM/YfMzK025gB eqflG3O/2QJIU/PkZ+Fn7bSkDQ== X-Received: by 2002:a17:902:820f:: with SMTP id x15mr3101252pln.230.1569572892248; Fri, 27 Sep 2019 01:28:12 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id 6sm2043521pfa.162.2019.09.27.01.28.09 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Sep 2019 01:28:11 -0700 (PDT) From: Baolin Wang To: linus.walleij@linaro.org, ohad@wizery.com, bjorn.andersson@linaro.org Cc: baolin.wang@linaro.org, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] hwspinlock: u8500_hsem: Use devm_kzalloc() to allocate memory Date: Fri, 27 Sep 2019 16:27:42 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use devm_kzalloc() to allocate memory. Signed-off-by: Baolin Wang --- drivers/hwspinlock/u8500_hsem.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 1.7.9.5 Reviewed-by: Linus Walleij diff --git a/drivers/hwspinlock/u8500_hsem.c b/drivers/hwspinlock/u8500_hsem.c index c247a87..0e8d4ff 100644 --- a/drivers/hwspinlock/u8500_hsem.c +++ b/drivers/hwspinlock/u8500_hsem.c @@ -106,7 +106,8 @@ static int u8500_hsem_probe(struct platform_device *pdev) /* clear all interrupts */ writel(0xFFFF, io_base + HSEM_ICRALL); - bank = kzalloc(struct_size(bank, lock, num_locks), GFP_KERNEL); + bank = devm_kzalloc(&pdev->dev, struct_size(bank, lock, num_locks), + GFP_KERNEL); if (!bank) return -ENOMEM; @@ -120,15 +121,12 @@ static int u8500_hsem_probe(struct platform_device *pdev) ret = hwspin_lock_register(bank, &pdev->dev, &u8500_hwspinlock_ops, pdata->base_id, num_locks); - if (ret) - goto reg_fail; + if (ret) { + pm_runtime_disable(&pdev->dev); + return ret; + } return 0; - -reg_fail: - pm_runtime_disable(&pdev->dev); - kfree(bank); - return ret; } static int u8500_hsem_remove(struct platform_device *pdev) @@ -147,7 +145,6 @@ static int u8500_hsem_remove(struct platform_device *pdev) } pm_runtime_disable(&pdev->dev); - kfree(bank); return 0; }