From patchwork Wed Dec 11 14:52:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Karas X-Patchwork-Id: 13903630 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 2346EE7717D for ; Wed, 11 Dec 2024 14:53:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB67510EB71; Wed, 11 Dec 2024 14:53:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="XAruuXCD"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9DF1E10EB71 for ; Wed, 11 Dec 2024 14:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733928781; x=1765464781; h=date:from:to:cc:subject:message-id:mime-version; bh=xaGhaebCIJpexM91lZQ+ckhCYvovlTJ2OdA8MsQBPo8=; b=XAruuXCDJxSDwKSx1wIFBUO33ivkBV1d1be2vSg8T2arYSODnqZUddzt kJhACroueEQFvst39v+dMAdJAnzofdHJYRFQ6TB0zRQoxoFlp5bpzvLe5 QB5K+MROo3O4NGUoq+5vVPQMQe1YuSO4DUgB0NrQpP5B1cqltxdd95Kta insRh27hF5NypChdRqu9YqP7IV7VzbFJPvqOl+m298Jqsn2EG/UtdtYBQ i0slBhWFLbN+VVPs2RQxVQXMnDrKA+ZveJrBVfs4HvSzrwwAwAOLVIPxG yIJrjcs8OxNmKvDBjInHSVs8eorY7h55ltdc/BVL682VoCG/c5sQSBQ9f Q==; X-CSE-ConnectionGUID: ujFGVwfhRKa1GJE1a0iECQ== X-CSE-MsgGUID: r9fqOSroR0+gtQw8CtSy/A== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="45719539" X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="45719539" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Dec 2024 06:53:00 -0800 X-CSE-ConnectionGUID: C2tUcDZ8TEOgbxfSTm3m2A== X-CSE-MsgGUID: w+B1q4h4Ts+wzHA2nW3Wrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="133214310" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa001.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Dec 2024 06:53:01 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 11 Dec 2024 06:52:59 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 11 Dec 2024 06:52:59 -0800 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.171) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 11 Dec 2024 06:52:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RCzzPU+t/VCRvUidtAYKqt1F9iZOx30Vz3njM189SxP8jZZWnbsxhuFyrUCJ5hlcY+Fs6W29dykj0XeAYBpc9i71YjESUaY9BginM4jVGYKcwJdO9X+9KU/eNBRaZXfnwJZnRdPStd0W2Rc3vfTzHF7c+0wQXooX8HLeWDdb9D9ALVBtXqgmxGW0hOdG4lHXXNc68c7gdNGlVML5Qjaiy29Tu6Zk1d66XU8uKa5pnIP/Q70PU0Y4IFWXxSmUyjOs4FLfDE1SS50K5AtFifFeEDpiAObTrsgfdhzmIbscH5Rv0k5xUMa8Opjx2IJWramiTDSb1jk3BK/remTpoUeuQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=O9lOIqPi8svFrrSm5J13XfVU3LumBu1dwvGlVsbabdQ=; b=QFKvDYcgRUyrxOxNmK3wgPmZ38HVu5R5l8Dskrq9XGWIw7HnS3YJMdDZaYdoIqJe8CBufDkf/HIwTWuSEfSpPrPuGMsdsRCs8jDUgKDN/X/efeeMxiv+F7EulWxOtIlAXLr7pa5yPiHitUDNudKzYwZuc4eWj75vRwBOk6wguC2QtxY2ZxsfgASlhb3QC5Mc25cLeaE/gYRMHDskG3bc00c1raejBbNBVILQm+6WwpznkUXP3MM+s+pwreY+He4z0YJBFN5Da+z65FNVvX6aZfFhgsA3tY032TILYi5i0Dnm4/lWVjXdHK5vucsxawZ7d9LtSxfFAzUPltLmoZxVnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from CO1PR11MB5057.namprd11.prod.outlook.com (2603:10b6:303:6c::15) by LV3PR11MB8531.namprd11.prod.outlook.com (2603:10b6:408:1b6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.14; Wed, 11 Dec 2024 14:52:30 +0000 Received: from CO1PR11MB5057.namprd11.prod.outlook.com ([fe80::4610:6d6c:9af6:2548]) by CO1PR11MB5057.namprd11.prod.outlook.com ([fe80::4610:6d6c:9af6:2548%7]) with mapi id 15.20.8230.016; Wed, 11 Dec 2024 14:52:30 +0000 Date: Wed, 11 Dec 2024 14:52:20 +0000 From: Krzysztof Karas To: , Michal Wajdeczko , Andi Shyti , "Imre Deak" CC: Jani Nikula , Rodrigo Vivi Subject: [PATCH v2] drm/display: use ERR_PTR on DP tunnel manager creation fail Message-ID: "Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316" Content-Disposition: inline X-ClientProxiedBy: VI1PR09CA0175.eurprd09.prod.outlook.com (2603:10a6:800:120::29) To CO1PR11MB5057.namprd11.prod.outlook.com (2603:10b6:303:6c::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR11MB5057:EE_|LV3PR11MB8531:EE_ X-MS-Office365-Filtering-Correlation-Id: 4493d880-3c9f-44f9-1a48-08dd19f36faf X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ym+qJnuWk1lNSjAXT63BfbQWw85La+4?= =?utf-8?q?BJRhtHhfhnXvg2EHIYW1V5GEO4elh9I6HDYA3D4aDaXHuZ/SnvyiSVTzsDCU2cFYW?= =?utf-8?q?0H3JlP10BGr8BFBviUYRWNh/TTpWLBvzEy4jxBRmL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JbXsi5q0FLdAKj?= =?utf-8?q?WsncrC1XwlFKlBB1bbDHg5JKBh7yCiD3MJLP7DaOItfSlo1XUUcuw9yGcCnhvN1gm?= =?utf-8?q?sv/RayTz8+N13o4WGwvtv6tBvwSyfI5JWeW3tzPWLq9VmsNnngZrtqpw7yICRyYud?= =?utf-8?q?Yrrctr0FZ/FVGR31tjHK/ULM2ln/C+XOUOwB34nfYMvlFmVyxHWKz84Uh1M9jCZeo?= =?utf-8?q?ByiJ5s3pL/Mds+olDZdS+k1w6KVHcIdfvoKqcjFQI4r7CYGoVgoMozk0Oo/A5eCXg?= =?utf-8?q?XNuzmcYIyypFwEvkaGg/85gQZ2JB6fb7DSg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR11MB5057.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?IgT7sIwNhpEDJ5/yOXHt5Oo2xuMc?= =?utf-8?q?bamVtFNl/Ga88015NcBojDjNuz1bnhgD3LgUXm0OLOiyLiL9VbsxXcwtDwyC55pwx?= =?utf-8?q?axywQDNCxGm9bV5nNysyN4JiLmohdi79cu/5X58ZGMrNj6+IHcT7dvGeYPbYDobC+?= =?utf-8?q?PBfz+T49+QYANklDLxxGf/ZnZ1hkcf30l+eJgQxbccIP3hqIuOLA3HI6B07bwQy7X?= =?utf-8?q?ebXzoi6g/tc5CcjHmkc2qpXBI1ROGt7gnHrIfdZj16AEoSUhgPuWPva/EAiUYjemk?= =?utf-8?q?XYFdrOnzOSCmUte8iP6S9gRPj4BdXjpbaA7szTPU+jQB1fSreYRefylzFZCycJsyL?= =?utf-8?q?TtJr/ufYmc6eQEapFz2Wq1Ufw8eeVnBYL5SwmXcacOeTQxLXiZNoNb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+kyFBhk0yQsZ4dq/?= =?utf-8?q?wtEDvOX9eFRZOXcMA9KQcjsAItNQrsf9SBcElKXXO2ErHNnRDlaoCMpSV20H7rTdZ?= =?utf-8?q?F2NLqhVifHnjAcV8FnkKb2ubFk1bboKFwoF5JgJYiMvyZQKUa6u7WqifonEq0h5xJ?= =?utf-8?q?RZYGQExnTCjfgkoD5ukL0ru2XDfbYZUfHSEKc/nXorw7QJPMKXeAbG8KI03FKaeIz?= =?utf-8?q?4PxCefjYNikv6/3jG7D0YzqDMkG71xwdevcg99flU7yUA8YqezragskOj9lbbvlYi?= =?utf-8?q?214CAePTDtDJ9z3E1yoQJ6AmFuHTJCKlsw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 4493d880-3c9f-44f9-1a48-08dd19f36faf X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB5057.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 14:52:30.2023 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zJBNRXXVtUzqV8XlcgI13EUH7qQ36nmoTB0tlIAJ5x8pntnnUMVz0WbhjWXVLYoKJ8hzNYlq9GT/FfWjqgsE77drwh/vX+6ox18AZMZroU8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR11MB8531 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Instead of returning a generic NULL on error from drm_dp_tunnel_mgr_create(), use error pointers with informative codes. This will also trigger IS_ERR() in current caller (intel_dp_tunnerl_mgr_init()) instead of bypassing it via NULL pointer. v2: use error codes inside drm_dp_tunnel_mgr_create() instead of handling on caller's side (Michal, Imre) Signed-off-by: Krzysztof Karas Reviewed-by: Andi Shyti --- drivers/gpu/drm/display/drm_dp_tunnel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_tunnel.c b/drivers/gpu/drm/display/drm_dp_tunnel.c index 48b2df120086..90fe07a89260 100644 --- a/drivers/gpu/drm/display/drm_dp_tunnel.c +++ b/drivers/gpu/drm/display/drm_dp_tunnel.c @@ -1896,8 +1896,8 @@ static void destroy_mgr(struct drm_dp_tunnel_mgr *mgr) * * Creates a DP tunnel manager for @dev. * - * Returns a pointer to the tunnel manager if created successfully or NULL in - * case of an error. + * Returns a pointer to the tunnel manager if created successfully or error + * pointer in case of failure. */ struct drm_dp_tunnel_mgr * drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count) @@ -1907,7 +1907,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count) mgr = kzalloc(sizeof(*mgr), GFP_KERNEL); if (!mgr) - return NULL; + return ERR_PTR(-ENOMEM); mgr->dev = dev; init_waitqueue_head(&mgr->bw_req_queue); @@ -1916,7 +1916,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count) if (!mgr->groups) { kfree(mgr); - return NULL; + return ERR_PTR(-ENOMEM); } #ifdef CONFIG_DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG @@ -1927,7 +1927,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count) if (!init_group(mgr, &mgr->groups[i])) { destroy_mgr(mgr); - return NULL; + return ERR_PTR(-ENOMEM); } mgr->group_count++;