Received: by 10.192.165.148 with SMTP id m20csp457029imm; Wed, 9 May 2018 16:07:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpExW+GFwBmqVbJTFNoVZYMoPkf89PZF6XeUh9a+cInj5x7wPCzfnge+Dhcv0xeCgs/Ja13 X-Received: by 2002:a17:902:10c:: with SMTP id 12-v6mr47284155plb.252.1525907254085; Wed, 09 May 2018 16:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525907254; cv=none; d=google.com; s=arc-20160816; b=yr509nOU8jGbBG5bV3jHjjrbY/27FR/U8VYRBAkxfrDHc7OZGPWb/2xeEKs/MORmrF PcNexAOwK2EPR4Itb3LF+nG+R/ssp7B6IPx1kqxHBOlE2lqghXp4sScQTJCFvejDIv+h tkT/cDOvWe9cQ3YxwLOgjC4BYkzQHoO94dSAN0Lb8sWI12Io7Z1pSaIvzEeMcdkLU1m6 mFmivUo1JSfnJaLmL2/yutCtt77BOm1VAFWCy9ABefv8kT2Y8+U+RRoYPGYX5sFNet3L 7Iii/OvygiGeYlGptOMudh2pA3xn9hZbieQSjOLuHCyiD5G2w2m3cn6CwG4K4oQB2hml 1Cvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=KRmpLxqvjBbvXfPKA4f9GX1wmRQStWXSJCAtMpCKk9I=; b=g20S6c4dU7bgspvAVBiia1rX8H1vvcaSxhTNgcF0KRRWuDG5DiPiez/tngvtDUnrWr Rv7RSCK51YB8vGn/07kVLO/QjciIgB3L6pZAqpLYr/u20mFLCdyQE86zcYVe4iuhVHD0 D5ZhTKpo7JlecsQds2g/BJB6XW/+O7/9Ag4yRauRxO6DBRaA81BVW72My2yjwpcFe9JC 10PwtaPbXGsrKiOXqgCVYjvpLKwsyNqBmH0kwiT3LSSVyn9Y6MWZEED/m3aPhathakCL X11QJCbl/9tbeK1Pt391NUPpeGiDXpEA5dP6E6bRFZVrNJRBkWpjqskryHpIRi1coQPw y7vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=G8uLhX08; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si28081260plb.19.2018.05.09.16.07.18; Wed, 09 May 2018 16:07:34 -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=fail header.i=@google.com header.s=20161025 header.b=G8uLhX08; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965928AbeEIXGh (ORCPT + 99 others); Wed, 9 May 2018 19:06:37 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:39057 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965426AbeEIXGg (ORCPT ); Wed, 9 May 2018 19:06:36 -0400 Received: by mail-pl0-f67.google.com with SMTP id c19-v6so120022pls.6 for ; Wed, 09 May 2018 16:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=KRmpLxqvjBbvXfPKA4f9GX1wmRQStWXSJCAtMpCKk9I=; b=G8uLhX08NgCxndBHClIVrT5J7fOuykMn5jLIm92XWujKbOpyQ3PE4zs5hv7wkrxYcE eDfxU1WAWexFZ8zjCPfJufzsFKEAu0CpU88kgxKIp/HK1v0wCESps6uKMr1W7LkHIbqv C304xKz7YoX6H7B9i8ukHflsdkra3pOX30osMNhg+iaipxOms72KAfdk/CUeByMn/B3k oI/MDnwQ3ahO088qn3WeaE8nfQjhlcQwNXLFBql4lmeh7KIg3TaXOlmLZ4LRsSKhRf0/ 1VMKBQGYPytS8EPn9Rd/QugQZkJN1WTDVRd5rJCOZ/HPvCqotnJiHsQsVXo7TE3hRwq/ uuTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=KRmpLxqvjBbvXfPKA4f9GX1wmRQStWXSJCAtMpCKk9I=; b=kxFBXIfXs8vCmiDE8u30mxB4PG3tvfpa/vNlE/r7QgMES0W037Oh511/J1IBif7kyR 5qE17sGBY15nHflAADLvDHiXq2M4aGV7OVL9/9RcrSZpBNhNmv8bUw8CFvORD2vb9uew FJRFWPbYSJ3rSa9hqt4aME850lKya/M1CjoDHgjpsAN9tlTWTUkY6WV57eb6MbtG15Oz n9FXdC2fVxi0Vs9RieJq8ieMte8445932pp32JXKoNZyWL55C1lkV+xNYsysxb1w0hwR nPNSO1UnLLpu6QOoP1AUUBlxvvi1Phxsyq7ML8ORmKHUy5i9q6SXLphhxgZCAzRMDMPI nU6w== X-Gm-Message-State: ALQs6tBdMSQstZhV2Q5FZNl9H9Ga5/iqQv/nNf+QvvsW3ES3N9BDa8Ig D46g6HftYIMvtb9ANKNL+LueRg== X-Received: by 2002:a17:902:2805:: with SMTP id e5-v6mr47635259plb.55.1525907195271; Wed, 09 May 2018 16:06:35 -0700 (PDT) Received: from gwendal.mtv.corp.google.com ([2620:0:1000:1501:9406:7677:5956:5d46]) by smtp.gmail.com with ESMTPSA id 76-v6sm3802372pge.75.2018.05.09.16.06.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 16:06:34 -0700 (PDT) From: Gwendal Grignou To: bleung@chromium.org, lee.jones@linaro.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] cros_ec: Use devm_kzalloc for private data Date: Wed, 9 May 2018 16:06:30 -0700 Message-Id: <20180509230630.258755-1-gwendal@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use dev_kzmalloc, remove .release entry point. Signed-off-by: Gwendal Grignou --- drivers/mfd/cros_ec_dev.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index eafd06f62a3a..45d42511a3e5 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -262,13 +262,6 @@ static const struct file_operations fops = { #endif }; -static void __remove(struct device *dev) -{ - struct cros_ec_dev *ec = container_of(dev, struct cros_ec_dev, - class_dev); - kfree(ec); -} - static void cros_ec_sensors_register(struct cros_ec_dev *ec) { /* @@ -388,7 +381,7 @@ static int ec_device_probe(struct platform_device *pdev) int retval = -ENOMEM; struct device *dev = &pdev->dev; struct cros_ec_platform *ec_platform = dev_get_platdata(dev); - struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL); + struct cros_ec_dev *ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); if (!ec) return retval; @@ -410,7 +403,6 @@ static int ec_device_probe(struct platform_device *pdev) ec->class_dev.devt = MKDEV(ec_major, pdev->id); ec->class_dev.class = &cros_class; ec->class_dev.parent = dev; - ec->class_dev.release = __remove; retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name); if (retval) { -- 2.17.0.441.gb46fe60e1d-goog