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: Yangtao Li X-Patchwork-Id: 13307132 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 B8454EB64D9 for ; Mon, 10 Jul 2023 13:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2Zrr++jwSD/TiEOv5uD/d+GV3FEPOWFbsJJgMGGI9CA=; b=0huXppT1eChtzu TIQwZJq/r6CJ8UQiL4JxLTEjF2ArINDk2f+jqM0LhYJQxmVDRJo8KtMKOxDRV858NzrKbJVwLcTiZ Wkw0Zyf+QtfrDwGlithkcB/VLnOM3eu/g2DxoeIE+CgMu4OHmDEt+woWkO6NWM/3s64V6JqjRz/Tj Oh/AfQSqdIEJEB7arAyRw4mgB3WIfGrr4s5uJiH/+n//5ehOeQJNniixl6uOFBNj4/fCUTqzV5dA2 tO6rdGfj9uI9zZQgH9D2VhmGm/nqjU3Hw2r/fj7OT99/MCgxbkQ9T29W3RSjQcBnsA/4YOV1bz3sg 83WCf0ysypA+FDvKDD5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qIqoc-00Bjjz-23; Mon, 10 Jul 2023 13:20:34 +0000 Received: from mail-sgaapc01on20720.outbound.protection.outlook.com ([2a01:111:f400:feab::720] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qIqoZ-00Bjfo-32 for linux-arm-kernel@lists.infradead.org; Mon, 10 Jul 2023 13:20:33 +0000 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+uE1azEZngGL5Z9SXpl7yr5In7TUo+tkJUonBSbIosgASFgN6qjVup5D8K0nJcUKMd2uIuFggwzR8ewjVpYgRoSYcDhGzkJ1X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/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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230710_062031_977647_364F3205 X-CRM114-Status: UNSURE ( 9.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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); }