Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4681575imm; Wed, 30 May 2018 09:55:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKINMAygHRJ2sCZe/OZjinafOivtbeEtOGRAeH9k/pECWwQ2iu/S2h2gW30dcfIHmJnXILS4 X-Received: by 2002:a62:b509:: with SMTP id y9-v6mr1208295pfe.121.1527699309428; Wed, 30 May 2018 09:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527699309; cv=none; d=google.com; s=arc-20160816; b=ZrevJ8UqPAbroHPw/NL5NB4yjKyA4RQcuSFB0urxBwBXVv+9/p1IwtBxpsqAhnfG0i +SFZa3KLcbPf4gc9t71+PA5jKj7Ue2YNu4hDMY4QyFauzc8v7UHPFolwrr3Ii7nSM9NJ mGbeZ+komgDoHHKLtoRSn6f3TD7A2CQpXrmF222fh7mXu4P8NPrR4Ov8GZkP+cBKrmZQ X8z3RAPKj1Mp/G8IgUZ/RC8ZdHrAGF+7B+iT7ZWj6UeTPWGr/qYbZDQ4yy1oy2FMdpXq 98ut2wQFbyiXmtgRnYv1bPVOIt5jjEoxMOVQWg/bESXH6UwvUEFpkytaAwJ5Nncu3nkC j+hA== 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=9Vl/4JfWusshTi/awdi4na//NYd/FEC5EOy9OPvHRMo=; b=h4UgALWurh7BfSn+aeHFEdtAMnoreNK5sR3TGnCWbmuvhLAAOfMFU6whaoHnzXA7Om NTnf+u/Z7jv+UoXJmw3d0znEdnVKjJHhlLwUujFBVrNfCHfnJV3wSXQ/rlgG54ZW6fFC Cw+3EidWeEnOrWPxoxIhRt1/ZOMNN7uqYDM+BShJYmzTA2IfJ45Ni7i3Vx0SMhkRSMJp u+66Bd6MTYTs5LME7SkX40fp5dbYGwnQVAXI47lh4u7M85Xv7rJE8At8x5V232QUKxyS FlMR1HClggyodx8qfeRciFtG8IpIAQXr7fNKkamIzIL4Vo1jJNzXwycx2GeXXfXhX8eM mo1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=QZkDZepv; 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 w61-v6si6105559plb.502.2018.05.30.09.54.54; Wed, 30 May 2018 09:55:09 -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=QZkDZepv; 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 S1753761AbeE3Qya (ORCPT + 99 others); Wed, 30 May 2018 12:54:30 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:42181 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850AbeE3Qy1 (ORCPT ); Wed, 30 May 2018 12:54:27 -0400 Received: by mail-pl0-f65.google.com with SMTP id u6-v6so11443037pls.9 for ; Wed, 30 May 2018 09:54:27 -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:in-reply-to:references; bh=9Vl/4JfWusshTi/awdi4na//NYd/FEC5EOy9OPvHRMo=; b=QZkDZepvlKBsVTiTgotyMVku7/foJTLaOrdMI/7vgTAbVip5cBecCLCkbpyUu5lrjQ MCBxBRiFtf4eeMotURXPKOfxLclH2b15RWEbOZcKFYdXNWdeRms17b3WQxIVniSO6Xeh xbWC7h7twY9QdqsbjXvwDBRURhVgYNuSGrhn3qPfw6vZnAp3J9nwaUom3zfzJpHJfFhZ 1MtMhh0omX4YU1OsBaaKxv06TzDLkR3gDa8U6OaVTEw6C32oEpGk38p2R2iw257KsI5W 9UeZzP7o4MhT96+E1+NUjMd3xgdmLcltZD7TX01XUAv2loYHMTwXsmXjj3Cci4DXAqp4 n6xA== 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 :in-reply-to:references; bh=9Vl/4JfWusshTi/awdi4na//NYd/FEC5EOy9OPvHRMo=; b=dhkIyKHg0e6intgsf+Uk7Jg55pTsXfS4xymSDrC/i1CCOwr9XyXo1q3clQ1qW2igNv MUeLCM7AAEiLLNgFoWh+a6MCp7M8jH1SBeGFuyfZak5YTOz8EMSEDCUxpupfupHxh2md rIOj87q0hCfoJPDucTsYlmyNHxs7KyElJLlw2XZewdY98WB7qzveTb8l/FJq9+ZpTWrX HSF4leo2AlcplkQqLcOD88kEplCszoWaIQKi2m7y6ZDNf4GxNykalf0ArlNVtWCvE9yK Mba1kJmc3aXITTZmAr0QcS95MiY3TURLGaDHH+EyPm2Xpcs0ZOaZmicvyLIgZtRn6fL9 rcGw== X-Gm-Message-State: ALKqPwc+dVSHTcySWwu3y9Q/pbiAcCiLa6gtJQVNWnbNYHWYOOAWYwMt +gX3jMYcme0dX7jQTRTGJUHQQg== X-Received: by 2002:a17:902:9a4c:: with SMTP id x12-v6mr3495100plv.213.1527699266658; Wed, 30 May 2018 09:54:26 -0700 (PDT) Received: from gwendal.mtv.corp.google.com ([2620:0:1000:1501:9406:7677:5956:5d46]) by smtp.gmail.com with ESMTPSA id y197-v6sm68212874pfg.184.2018.05.30.09.54.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 09:54:25 -0700 (PDT) From: Gwendal Grignou To: bleung@chromium.org, lee.jones@linaro.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2] cros_ec: Use devm_kzalloc for private data Date: Wed, 30 May 2018 09:54:22 -0700 Message-Id: <20180530165422.51178-1-gwendal@chromium.org> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: References: 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 --- Change sinc v1: - Readd __remove to avoid a warning when loaded as a module. drivers/mfd/cros_ec_dev.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index 1d6dc5c7a19d..81466264f7fc 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -262,12 +262,7 @@ 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 __remove(struct device *dev) { } static void cros_ec_sensors_register(struct cros_ec_dev *ec) { @@ -392,7 +387,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; @@ -414,7 +409,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.921.gf22659ad46-goog