From patchwork Thu Feb 3 14:10:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12734177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB0B7C433EF for ; Thu, 3 Feb 2022 14:10:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3591710F9D6; Thu, 3 Feb 2022 14:10:35 +0000 (UTC) Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3381610F9D7 for ; Thu, 3 Feb 2022 14:10:34 +0000 (UTC) Received: by mail-pg1-x536.google.com with SMTP id h23so2350338pgk.11 for ; Thu, 03 Feb 2022 06:10:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H1kno40kXqd5oHnIK3ylT4ecdPILvrVqPlIbaZeuMIA=; b=drsICCKIjZX+H+10whVsgZJFA1+0cYNv1js2APo/s1v8pCpku3jVbowqxbuOJFdyPZ eCFF9GBNQFMrryrGmg0o1+bH+hqaVaAjf9PWtFX92GX5YXdMVtzUeaEmI12HIzIJ3hVA qqdKLTx3O493QIoXDmIdHviLYtcBRB2ANndEw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H1kno40kXqd5oHnIK3ylT4ecdPILvrVqPlIbaZeuMIA=; b=k2DO1F9ajcCx3ZYo4Vpi6A8Bn6Y3F9JP4r8ahhkfobv6Xj1NWs07lqbJqxlmtTpeCc yJTBwB7vI1xv58CMQ/ZYXiQUU+Dp86EC3IuuvFvciUmnQP/YJ/iFKDHPmQDHCTtkIE6K But9B+hfsIlCBu69pZIVdecx+IS0PewP+TzcGgbrwynhNivU6L8In701OD1G0lAHZhzB WjZlPFYSQZsDYc4jCL4RpEErS/611Ms+MqXV6/s9tIlmESisNLwu5gDKQSr0JOujfcoh hLnfLU3kjVN73ufXfXMH9C12vWLSzhS+piojoHlK8KkIl/FBWqdsmVSq/VIvgqAh2Knc uVAQ== X-Gm-Message-State: AOAM531Y03eQ+0mMZcD3wd9Z06mtdUl3jVmXCRGCILGSMdqg9o3+nbzh VdJSVgzvsriXRX649jrOfTl6EA== X-Google-Smtp-Source: ABdhPJw++DYqdL6VXabn9xYbAD0hZxWkFqsafO1u5OC5tXWjzCylo5+MwrUwxx4aTE7IaEP2FXKcXQ== X-Received: by 2002:a63:6b02:: with SMTP id g2mr4627954pgc.526.1643897433413; Thu, 03 Feb 2022 06:10:33 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:cbdf:65ae:127:f762]) by smtp.gmail.com with ESMTPSA id w11sm29532818pfu.50.2022.02.03.06.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 06:10:32 -0800 (PST) From: Hsin-Yi Wang To: Robert Foss , Rob Herring , Xin Ji Subject: [PATCH v6 2/4] drm/bridge: anx7625: Convert to use devm_kzalloc Date: Thu, 3 Feb 2022 22:10:21 +0800 Message-Id: <20220203141023.570180-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220203141023.570180-1-hsinyi@chromium.org> References: <20220203141023.570180-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Jernej Skrabec , Neil Armstrong , David Airlie , Jonas Karlman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart , Sam Ravnborg , Maxime Ripard Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use devm_kzalloc instead of kzalloc and drop kfree(). Let the memory handled by driver detach. Signed-off-by: Hsin-Yi Wang Reviewed-by: Xin Ji --- v2->v3: remove kfree() in anx7625_i2c_remove(). --- drivers/gpu/drm/bridge/analogix/anx7625.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 17b23940549a42..b7e3373994b480 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -2515,7 +2515,7 @@ static int anx7625_i2c_probe(struct i2c_client *client, return -ENODEV; } - platform = kzalloc(sizeof(*platform), GFP_KERNEL); + platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL); if (!platform) { DRM_DEV_ERROR(dev, "fail to allocate driver data\n"); return -ENOMEM; @@ -2527,7 +2527,7 @@ static int anx7625_i2c_probe(struct i2c_client *client, if (ret) { if (ret != -EPROBE_DEFER) DRM_DEV_ERROR(dev, "fail to parse DT : %d\n", ret); - goto free_platform; + return ret; } platform->client = client; @@ -2552,7 +2552,7 @@ static int anx7625_i2c_probe(struct i2c_client *client, if (!platform->hdcp_workqueue) { dev_err(dev, "fail to create work queue\n"); ret = -ENOMEM; - goto free_platform; + return ret; } platform->pdata.intp_irq = client->irq; @@ -2637,9 +2637,6 @@ static int anx7625_i2c_probe(struct i2c_client *client, if (platform->hdcp_workqueue) destroy_workqueue(platform->hdcp_workqueue); -free_platform: - kfree(platform); - return ret; } @@ -2666,7 +2663,6 @@ static int anx7625_i2c_remove(struct i2c_client *client) if (platform->pdata.audio_en) anx7625_unregister_audio(platform); - kfree(platform); return 0; }