From patchwork Mon Jul 10 13:19:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 117924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5034848vqx; Mon, 10 Jul 2023 06:43:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlHPCaV998Rbyg3lKiSCCVJgu0uJcWQYwDB5JuTMx1+nid1YW2wC/N14N2sSBFcovefI2fTk X-Received: by 2002:a2e:998d:0:b0:2b7:acc:fe63 with SMTP id w13-20020a2e998d000000b002b70accfe63mr8320849lji.52.1688996617753; Mon, 10 Jul 2023 06:43:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688996617; cv=pass; d=google.com; s=arc-20160816; b=l6ys+TFWPOaGcY2P0otxMwQiFn096Ue+R2vADFQOV/UuYYRbUG/lBzSnA7N0buMQ+c N/L45fDFqlAWtoaUiDNExTMiuXVxR+yLLqa7B06umL/jBS9i9JLjXDATekAAMwuj1O0J xScxnksoC6StV7c78sXuDc3w/IQiYQVVlxACRa6DEb1BlZAuXwSUHU7NXRv90lvzm/2h qvim8BEf9EqXffQ7C5uWOEpbkgbuAzGwSHGNrSbco1rlJ7Y8zcC0GRjyLXuBKcFEQ+Ey a9Do+hXzJi8aebXmg2ZdOue/Z6W9e+wVXauETlh/bS5eeqEKoBa3qy9HwZy5fpyOuh/k C2Sw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9uLvBxlgOCiMfG4qdNtV1IihRj/C0F45jnM1mERrGXg=; fh=UOCFwyHp0XuBMl4DW/Dx0U7qtACvhetokf1XSE46AnI=; b=BMeylBUeWARlysm/csk/ITzN4da6+fMInb4xj1nYwedaF0+SVNA/Fh092pCv1WLj9R 9o9Ya+rZSs991P8x3bu/DFF+83IyinYnoR9UWb8wAYlJqJTuzgWJGVefvDl+dG5kvZmd /o94i96Ot3BHu6WkcSQHTAiYZnBU8kNMlmtDTEdAKpPEO+dSC+bjHE69KQICI89Cex7M FDxbzmIFD8KtWY7sa8fJp9jsY+Fi5saY5H/Rd6pJ5zIUnf5gjMUeODIrqoU9+YMIBe1b CN4XMUIsuL+MX/O933sdwna44R9P089Au+gmg4LWNMtnRm1t/cZ8mcm0tsdzkdd24gef so9A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=c75HHhkn; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw8-20020a170906c78800b009924c43105csi8406932ejb.94.2023.07.10.06.43.13; Mon, 10 Jul 2023 06:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=c75HHhkn; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229722AbjGJNUW (ORCPT + 99 others); Mon, 10 Jul 2023 09:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231228AbjGJNUU (ORCPT ); Mon, 10 Jul 2023 09:20:20 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2113.outbound.protection.outlook.com [40.107.215.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0475FE2; Mon, 10 Jul 2023 06:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OqVnUls3ywsy+qXHsZnAW82u59H7KCldHaN3Vrqd4XyGjB0Ty9pw2iSicVMNsrAoObqrOh6RbCdARcgjZYhjmt+ky0TIQUzmdnvS4BC8i3xCRT/X0k8IVdUULpvOyoK00aPKzkQIdjPLt52mlRilXadk7gS0FtvKBjpoC6S1N04jwnlUxPsOhssY+gEmfTa+wL4G1yA8nz5biRJKOM68UsrUBgscLJSoHpHE9F2jizxW3p78Go5bEK9IUsXpsDT5zKaPvhGmI0JMy7iaU3VSXCBkYUoNeG4By9X/mHh/anWi+GIuGbhuiQY6E2ILjgSUnRoPHX65zbtAoXiMaSbk4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9uLvBxlgOCiMfG4qdNtV1IihRj/C0F45jnM1mERrGXg=; b=Umm7w5KBoZBV5ucmkRNz2SnrqGixsOoAZW87BSO32VcDa+4XQwUsRl/USAOtj0WaVC6g+KAUGJD+s4NfP03RAJPm5mt9+JYb2c26lPQWA01h22VvwR0AvEtAM3eKrS+Ol9ic055wkel1vo18BnqxS5HmcJA3hwXNGxtTL7rWzKE5X4eaNCQXIEJ8c110uEhVpIVaPgXHDm27Es/M2Ju7lCwtu7i0WhLsbazyXDWaNFjpM/yFEr7y56arkWB386hweIwBzi5KyP2PVaGeBKA7/Y0a1R27vf1orlow856j6fPhg3vX4Tr6hVuPl/n+Xfee/YeSeyTo/KFa35LBfT5OHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9uLvBxlgOCiMfG4qdNtV1IihRj/C0F45jnM1mERrGXg=; b=c75HHhkn7MivlFBNy7fg2hkCaPXCZkAhh2eO+Q02qa2hS02bTHuQ14Al1IN2/Tez6eA7KgAgq0U5aHO5dPfFyNpOvjIl64wpHneLc/dQBe2L885U8jATWguHsoXmgShyLY+zodfnoV4W9xcr+IEp5xjd959o0/5gd7ltX33qJz4l2XZN6V73hNq1xxv7eK99Q0LVK6RY3XhVEFUbJ4IqDqL56IvhcI4fgBrDJnA3XCyRNxyKsBtj7Q/Iu2+MuMRAODEpwX6uy2np8NTCtXO8uVShr516GJrbZ+GqsCmupCLw36H8zeGaZ2T9n9enT/mpSsQ0TQCuZgXvR8/G75UBxg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by SG2PR06MB5131.apcprd06.prod.outlook.com (2603:1096:4:1ce::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 13:20:13 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 13:20:13 +0000 From: Yangtao Li To: Sascha Hauer , Pengutronix Kernel Team , Helge Deller , Shawn Guo , Fabio Estevam , NXP Linux Team Cc: Yangtao Li , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] fbdev: imxfb: Convert to devm_kmalloc_array() Date: Mon, 10 Jul 2023 21:19:59 +0800 Message-Id: <20230710132001.50764-2-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710132001.50764-1-frank.li@vivo.com> References: <20230710132001.50764-1-frank.li@vivo.com> X-ClientProxiedBy: SGBP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::17) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SG2PR06MB5131:EE_ X-MS-Office365-Filtering-Correlation-Id: 276f9f91-5ddb-4655-a604-08db814864f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6SSFd6f+wfaTpX6YRr732cjKEzpmJoyHk6xCxA+71gViXA9WGqPaPpqt3UB/96fPoJHwsvw+x3Vl+gNL2DdCgS/h1qVscgOHV5Et2fGcrdTESOANefHZdOx8Htpy3VuVx1DLfNsCV4k0+wGt/Mkg6CfGbqxkUT6BoznWs8IyQvJhefX0167ging3uSAzTdTRQW9TvgIHIEwE7nl0yXBj4AvFNqXMlGR4lbkG/TM4ld7+w827Ml6l28KHTKPlBrjmNKlLxngoYbpmj47Pgu2fOrcOMDsmWIV1fXysxTZUfGfOKX8dAdqWG07liNXp+XZNKrzw1qgWkh7IE+HA8M04LpiqaIQyoHM7yBnmu9kVr+hnCL4T6Xa8EC6V1NBv9/xXKZDUQw7e2HsCPLa7YHit7jKIJamhDyJ3h5z/3gRCcdP2rr+JZX6V3x83HlVCeZmFOazj0mRCJwo7AeVb9LID1w0PS2On5g/PvZsr+K+6FwgzyeW/gX9J4Nt4onysAY4fWIQm3fM7nq+2W4RHSUY7g8WWusDfqX6gLzG2JQFogFI29kU5x4lPSJrF8jOs3PHPPENE54UzgaoqgXOeI0SlS7yghiApNLF+vAunxC57qLxkcscUWQeGxPKQuxJkThsi X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(376002)(396003)(39860400002)(346002)(136003)(451199021)(38350700002)(86362001)(38100700002)(66899021)(36756003)(6666004)(6486002)(52116002)(110136005)(26005)(6506007)(186003)(6512007)(1076003)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y2KBrwTh3t4RAWiKGKbDwmNpawuXRltKBB3PlMN46FNKozk9wyJl/nTQCKkcpJJXuuLHNBpBs5FThdka+4ICuhPN6p9Fh4mpfQEiSXmjF2OJurRsZnHEtPhXKjvugB20CmBr4iqtfFJk8sZSzmnoA4IpnFpyLqZPxDCfCezmmSZiMXjCksF7xVry9tqjMaayKPTqlRkyg1JA2g4YGaUvhk4KNWq9XIaE4zNnANB7JubmJ9qKI3Hnl7Z09iAEWHqcu5vZFkm77v4Ejwsz+N3QOKLpzjfMQh1E+cOIVijo9BF6i7RKdjAwYRaQGVMcCydbaxCycNhnfXCvE5sIlYJhjiHTcIM1LfNpN72xuoo813xmHyBy+AQ2Ds6Nkp3+T5CSiCjOdcEpYQ6Z+uE1azEZngGL5Z9SXpl7yr5In7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ezr98FifhCYEAczNd+lhlUah7BAogiqVZxPV7nH1cRESu18TjS1WILFcaAsdVSEP4nfsVHWoZuR/9H3sIWm/8BOBrgnJmb8zny71J X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 276f9f91-5ddb-4655-a604-08db814864f7 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 13:20:13.6796 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DxiIoVvxQ745r9sa42n0GICWlS2MLeoD3MdvwXRgwc7dRvD4Nk4a1Im0XZJKxbw/biyS7a6uumvBAnwVJduZjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB5131 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771041317298124591 X-GMAIL-MSGID: 1771041317298124591 No need for manual kfree in the error path and the remove function. Signed-off-by: Yangtao Li --- drivers/video/fbdev/imxfb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index 385c4715c7b7..7020b5f6434d 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -673,7 +673,8 @@ static int imxfb_init_fbinfo(struct platform_device *pdev) pr_debug("%s\n",__func__); - info->pseudo_palette = kmalloc_array(16, sizeof(u32), GFP_KERNEL); + info->pseudo_palette = devm_kmalloc_array(&pdev->dev, 16, + sizeof(u32), GFP_KERNEL); if (!info->pseudo_palette) return -ENOMEM; @@ -1044,7 +1045,6 @@ static int imxfb_probe(struct platform_device *pdev) failed_ioremap: failed_getclock: failed_of_parse: - kfree(info->pseudo_palette); failed_init: framebuffer_release(info); return ret; @@ -1061,7 +1061,6 @@ static void imxfb_remove(struct platform_device *pdev) fb_dealloc_cmap(&info->cmap); dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer, fbi->map_dma); - kfree(info->pseudo_palette); framebuffer_release(info); }