Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5353783pxb; Wed, 19 Jan 2022 16:52:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPkiwzrxbXiFgZ/MeODm4tpN5hmqAT86rXOBymVBRh28o4QJ2/SJxs/9W5G1a/Q7fUt2C7 X-Received: by 2002:a17:903:110c:b0:149:8018:e9d4 with SMTP id n12-20020a170903110c00b001498018e9d4mr35243950plh.117.1642639957350; Wed, 19 Jan 2022 16:52:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642639957; cv=none; d=google.com; s=arc-20160816; b=E6xmyZc3SmFyzetnKFEJg89RLQUA2Zeyi3NKp3otR0qejRq2PV59ydogXXiBxEkj9r ciu9xDf8f16gDqCa7e5W2XYEEMGplnKN1WIf5DUa+edGyrH9LM5qlVNNaSpwuG10btgn RQ9cr6cxrR1XoPpkIHnxkiBmkWhxASQMYelHPK0ky/wjETQk67bTut4SjuvBsAVv9Ks8 t3w+ykceB0apYSJuT0bmeHTM7amZxhYHBz4HyyKw0QrkNKFoE2T9EVyhqe3NptinCfE6 5QUGc5Ag1zYwB75uMNzOWpqthhqXnu4dDfK7viILGXVY5O/E7xDuApiIKLSTQi5Y7O6g r6Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3q9wkMinheXrqXy/yp63auEPN8EtJaQhX9gCBlzKxgs=; b=DUngSYuqX4w2dxiQrwFOec0WW1HDoyH73zt4+uoBDBSnc/CyIc/622XwgxcPy9VOGn /85+C5HWm4QGB7uECC4xmADKYJewrF0HaKw4fsSYX0CJMeorXh2V0/KRwLevGqnkSE4S dIQD6uSe2KUnQe3cA1JtiGMGJThSL3Bz31daCENceXdvl39ge+NvzUsiBcO5crcmE+SJ URqzC5N/IJpFjlk4LZIbI/ktJWl2R/8xbGo92HVgC9jKK9f+RlIDI/P4o46yQmLpJhRp 3ruzJGWxlYWWrMEJpZFq/HqilOtArQxIHZOyI/0DFPnOPLSaP5wuxYUe+1Gv4Zoes4F7 j+5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aK2MDPeS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si1457226plc.406.2022.01.19.16.52.02; Wed, 19 Jan 2022 16:52:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aK2MDPeS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345612AbiARJUT (ORCPT + 99 others); Tue, 18 Jan 2022 04:20:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240750AbiARJUL (ORCPT ); Tue, 18 Jan 2022 04:20:11 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E352C06173F for ; Tue, 18 Jan 2022 01:20:11 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id u11so18627478plh.13 for ; Tue, 18 Jan 2022 01:20:11 -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=3q9wkMinheXrqXy/yp63auEPN8EtJaQhX9gCBlzKxgs=; b=aK2MDPeSWHHwrY//afMrQLweMQ/RyKgAzoZfk/ZzlXXfqJg6DzJjaAF7Afq6nR6xKn FA0J3a1IxoYd4QbSJXwdD+TS1H2RCzNXzWIhJbsXnkcnpL0zUEZEr7rTiOSRrm9cyMb4 uiWExIlSi++fDL7WGEZ8vh5ANpKjA5VmhH0Jg= 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=3q9wkMinheXrqXy/yp63auEPN8EtJaQhX9gCBlzKxgs=; b=vcN1KjxMltfgWjmeR2kdb9K72/9AorRUX+F7UETA7DmXdviazrTYGbfEESWeaEk3rY srNmPLzyzdHKpl3EExTmDu7qdm0avtPJ/rhg4u7vohRktBxid/9FUuiIlteM9/bGTsmi ccIYb94ctoDBaALMOAWz3A5OcMWSG/4CfhTKERGRvg0UChJlKjcyFteztz7xdlgYicTH 4KMazsKsitVP9lPZ7fxaXH8Uo4lgINUXtqqCyBHKfyhMnuEE98QjlhIaoY5ogRo/iTJW uf/Y5+R9qHWQXRPAYPEBK+UsRNOy9pdlOq/xijlb8FJJpSt2LDKX+Tivf6SJgclLytKs v1+w== X-Gm-Message-State: AOAM531V22e27OZZZBa7BZuTjEmynzWaQj1niQznUBP4lBLYbrOHERu3 wrZhTdMRsqrVgHbK5ui46tSNbQ== X-Received: by 2002:a17:90a:380b:: with SMTP id w11mr29582367pjb.113.1642497610547; Tue, 18 Jan 2022 01:20:10 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:4448:8072:97f1:64dd]) by smtp.gmail.com with ESMTPSA id y1sm14691501pgs.4.2022.01.18.01.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 01:20:10 -0800 (PST) From: Hsin-Yi Wang To: Robert Foss , Rob Herring , Xin Ji Cc: David Airlie , Daniel Vetter , Laurent Pinchart , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrzej Hajda , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Sam Ravnborg , Maxime Ripard Subject: [PATCH v4 2/4] drm/bridge: anx7625: Convert to use devm_kzalloc Date: Tue, 18 Jan 2022 17:20:00 +0800 Message-Id: <20220118092002.4267-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220118092002.4267-1-hsinyi@chromium.org> References: <20220118092002.4267-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.34.1.703.g22d0c6ccf7-goog