From patchwork Thu Jan 13 07:31:56 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: 12712350 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 E571DC433FE for ; Thu, 13 Jan 2022 07:32:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F3483112136; Thu, 13 Jan 2022 07:32:05 +0000 (UTC) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5CBC112136 for ; Thu, 13 Jan 2022 07:32:04 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id hv15so9552003pjb.5 for ; Wed, 12 Jan 2022 23:32:04 -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:mime-version :content-transfer-encoding; bh=du7UtZTksojdMdJU3Db9bmQRhjFxVrsUPN0QxzhmRfQ=; b=XRWcnUSui98p33/sm26qBbm54SzZ5iNXYwDIcVdlfutHdp+FoBy9DGkBxVpyY1qhqe F7tIH3HNM2cBotmLWDmhP9RiKfRNuuIkg5LKMAQ1YUFRU3ZgzZdcEaZ+A2lEnBR9RFSW 9tcWf7RSJa+K+GpQPptN80vS5ud6XPJCKCZZU= 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:mime-version :content-transfer-encoding; bh=du7UtZTksojdMdJU3Db9bmQRhjFxVrsUPN0QxzhmRfQ=; b=urOraeE3Zt3uPD+W0gL8R4F5oS1cLPiSJ7x6To2z7V8OPZrW2lAmZ7+nBo+hsehCEH jDWy6a5Vp0yMVWKupJnIlsCe+rALZNGc0NMwgjNrq1S2mgI7T7FttbmolU4HFhvvWByZ nlhUkT5D4nvTV9PfXGo2W4DuGEIobXBdL6dIYTzLhobKbh42z096RZv8JEnQwfM2tdox zrFB5z+jd9Cu8jozqLb2mplYxku2DL7sqdyRyATP5L7Q4mL8XSY1LnBDCypAGs6ZpYSI 3GzlLxk7BR14mPX0d5Tvq2NhZ71GgRZCDKG3KjVoIjjIY+dW1bh7UIsjr8rsQeiVMFLE gP5Q== X-Gm-Message-State: AOAM532MQAs5q9rx3zTIYYuD6yYL8RlYYFMxH27w0+a1Eex/buXmkcXq 3VSWCfV8/E/ScAXtbhGVT41goeGTLJQAbA== X-Google-Smtp-Source: ABdhPJzVfQyp3OrIqmUib4qqArq4Pah8l2B6psdTAz7f/amb43BdGKeleLHCVHWdiaVpTaelcbMCrg== X-Received: by 2002:a17:90b:4a47:: with SMTP id lb7mr3756416pjb.126.1642059124107; Wed, 12 Jan 2022 23:32:04 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:3ced:e0da:4852:430c]) by smtp.gmail.com with ESMTPSA id om3sm7747701pjb.49.2022.01.12.23.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 23:32:03 -0800 (PST) From: Hsin-Yi Wang To: Robert Foss , Rob Herring , Xin Ji Subject: [PATCH v2 1/3] drm/bridge: anx7625: Convert to use devm_kzalloc Date: Thu, 13 Jan 2022 15:31:56 +0800 Message-Id: <20220113073158.2171673-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.34.1.575.g55b058a8bb-goog 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, Andrzej Hajda , 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 --- drivers/gpu/drm/bridge/analogix/anx7625.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 0b858c78abe8b6..dbe708eb3bcf11 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; }