From patchwork Thu Dec 12 11:00:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Karas X-Patchwork-Id: 13904973 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 71950E7717F for ; Thu, 12 Dec 2024 11:02:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1336910E07D; Thu, 12 Dec 2024 11:02:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="M1er8+iZ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6143C10E07D for ; Thu, 12 Dec 2024 11:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734001322; x=1765537322; h=date:from:to:cc:subject:message-id:mime-version; bh=0D9usJYc+n/jeBwBtS9iRHf6yzTKvkdRMZjYQOFjeYU=; b=M1er8+iZ7XfkHyf2EYsc29xWy8q6h28f7E6sILAQ3QenU6sJBXZsocpg XNxNrkoG+Cq9KRX2syxs1E+5tFvxiXA9iljo5t4Trl3N5PDgSrXtu5qXv sywHDovoDBk+DCYmC1LAJMBG9009oVsafdngYh5v2hzvQSw6zGhBFP8xH cKOaXePzK7BHmnRS4x0qng+i3SyjDNMAC+/Uw4NG5F7eFMmmqwcnvb9Ta VKxvktD4+7DtbprkXX4H0R2pHiIArEyzHqFM8nNqbcOVV0wBgJBjED0KX WMt+9XF4+69B0GXHiRYKbY3aX7HQfFZgm63ERTt22Pn3CGxYIAqyvfC9N w==; X-CSE-ConnectionGUID: wvvJlBzmT22LQN6pSLJ9YQ== X-CSE-MsgGUID: 9L1LvUmkQ2uUv2BH6kN7Ug== X-IronPort-AV: E=McAfee;i="6700,10204,11283"; a="45021656" X-IronPort-AV: E=Sophos;i="6.12,228,1728975600"; d="scan'208";a="45021656" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2024 03:02:01 -0800 X-CSE-ConnectionGUID: N+7SHRZtTae7st2RZiiLww== X-CSE-MsgGUID: FBYw7LPQTFm7CTFb4aggCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,228,1728975600"; d="scan'208";a="96278999" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa006.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 Dec 2024 03:02:01 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Thu, 12 Dec 2024 03:01:57 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44 via Frontend Transport; Thu, 12 Dec 2024 03:01:57 -0800 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.42) 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; Thu, 12 Dec 2024 03:00:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hos2O6Wf18tPw4aUlqH3h+cZriad+5jBsIkEJfxBKpssByqBdZ05zOkWIhNq/4mo2gw+5dDBIQ2oG0z/9WdrCd7CKq7AN1staesTN2gqU00NIk6PErzRvq9U7anBk1AM6Jp6wgbhLp790ieXQ4c+wkTvSKCR9ChqgjyJG1gP55SQt+gbvR7iP6Uz65vkHmuee87+Z1Uj8hz0fBwVBUGehCMwfPyPWlWa5dkyM+hT1rbdKFCTr32Yic2fvK19w/VGDtRdTnF1ublX3wYj3pO8eASEXkuBEbIOC2jxueJqN0ofq3tpahsGjfrkuYlTu5ah73s3D3yNEjrkwrwBvJF86w== 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=nef4EOG2undn3JlaVkisWnEot5zQqScqtEtUZdYH8XI=; b=SjcxbQBmKRlBdlc7R2pXmTrEkSPJWLDBAhbQRp+XkTzeMnchKwnMgfrg5+oy9nAKFju301kcKL4gfnZ2bXYKrm2jT+pz0H5oGhsdiMPZMkzzdQXGbItxZ9v1kkpAKMxx8SeIsl765wgQxxL4dvSEOjXazNSnj+wxOk2N7T28+JZkXyERyemR7qeYvfp8P874kULIygoIRn6F3L+gydoPZgS88ZnVlhImKdas5PuU2j+aUftWF3JhfSqG1BfNoycPxfc9LTt3WFaurUC3BfDix7sHgTadhZVoFRY//zeSYqSAyFDdZUdK4yiYHb7wmZY2FPEd+qybcJ017ibVBtZl7g== 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 CH3PR11MB8344.namprd11.prod.outlook.com (2603:10b6:610:17f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.17; Thu, 12 Dec 2024 11:00:50 +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.8251.015; Thu, 12 Dec 2024 11:00:49 +0000 Date: Thu, 12 Dec 2024 11:00:41 +0000 From: Krzysztof Karas To: CC: Imre Deak , Michal Wajdeczko , Andi Shyti , , Maxime Ripard , Thomas Zimmermann , Subject: [PATCH v3] drm/display: use ERR_PTR on DP tunnel manager creation fail Message-ID: <7q4fpnmmztmchczjewgm6igy55qt6jsm7tfd4fl4ucfq6yg2oy@q4lxtsu6445c> "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: MI2P293CA0012.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:45::10) To CO1PR11MB5057.namprd11.prod.outlook.com (2603:10b6:303:6c::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR11MB5057:EE_|CH3PR11MB8344:EE_ X-MS-Office365-Filtering-Correlation-Id: d0ded75a-ab75-4095-4d1a-08dd1a9c3cec 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|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?q?08TnlERmPW7hW6V+IJ7xAMbGCJOnrum?= =?utf-8?q?DoJFeTlQgf/ivkExWkOjnmlE2lQOlkumM6GmWJpG0fJFOyHixPTtfO7jSsH6DHXly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?= =?utf-8?q?Iav8Fx2fl9R5I07lzxXf4ZfiRvJYFejzw7U1F8FNOVfjeTodYu3cjW6jYYSRE4IFp?= =?utf-8?q?UE0TyJJH7mlZLmYQ0My3++c+BCLM5isJFJT/F918J9AtTm++uti9Y/gI50RQGuiDG?= =?utf-8?q?++gfr6MCQQB9Tla62udx6EyeOpjPHKXzP3ptZ+/4x1K8A4Gs/nTM92cvzeoQI8DNq?= =?utf-8?q?laoJoLerLprzHsZOTeg7YGaf1pyzQqp1+UWxtg9Jxzo4u0y66/q+gpv8hw8IO/OyP?= =?utf-8?q?XM0OruTd25cPk8ugZqhhJNvls4rmxtVtOnYirJSNfWtt7biFjg6aJz0ExD+WQo7r/?= =?utf-8?q?NnTp691JhS1yqj2cMJZAXGF6xwGg/g7Ndzg=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)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?13mRd7ttqULiwdUKzSy4QBSOJdaZ?= =?utf-8?q?PAooDcXCMuCmAofjjKHoUXUx14WEB2Wj/o0T+gNL0oZ77S8j4kgl0bFCfTYncW9JU?= =?utf-8?q?mgHLCAbDpNG//4JyUR+oDAUfj+bov+P8/cWh+X+hfIzvtJ7aUahyx6UKbgs9OlluD?= =?utf-8?q?YsvpSvWM5pjciMmV7ZOk3Irz+2l39fBAxpK0Zww9LgfnyjqzXS2mYC1sJp6afyigg?= =?utf-8?q?TairxdFR1iDcTBe0d/8IVbHQN4TioE0RARyhysRSXrn+iqweJdLqn4mRIruWUvjq5?= =?utf-8?q?It8FlvAeYWUCmTE/WhyX8/SRRxFE981C1p+2pHW0HkfgGXfkV0xRzH/mapCp4JElo?= =?utf-8?q?D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tjE+/G3MgsKchRmevSUKvAWPE/CJHb2ypmx1poPdKDwGcevbetuEJ2Tqrt6MViH6?= =?utf-8?q?CLly4iBbDSDca/7Vr1+1/x1rTiXvQcaomFU7TydkjUMCe6S48RQpYiqrbiQ5aURti?= =?utf-8?q?6oqgVtp8wlDk8CLkOnr0HLWdZKPk2atRs7+c67Ab2sVgBd8HAhfiaHKRGnrPHBWcI?= =?utf-8?q?1mQPtI/a3ed7VMghAJoMNISIIrZPCXrKsCiu6NXNtB9BEY/GraQAXTmpe/yxxm/xn?= =?utf-8?q?Ip5+jb2ERQ6/SpM5Rs6UzIehXkebfzxRKJmtYS/yQTJEeh7OuinvIFFaqFeZgYvNB?= =?utf-8?q?nqwRZRiBLQ3yXD90apExWH5ca28fb4Ia3w=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: d0ded75a-ab75-4095-4d1a-08dd1a9c3cec X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB5057.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2024 11:00:49.8477 (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: esua5XSPSLyff/CV++txC/CkYDLnuX/b2JR1bL4hWl8uLfp+LJ2eyKeuaFlI4I+/s9aLGPoT/JYHIond7yX/T7GeeGp1oSJ/BhgrKPgbZgc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB8344 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 to align the function with stub that is executed when CONFIG_DRM_DISPLAY_DP_TUNNEL is unset. 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) v3: fixup commit message and add "CC"/"Fixes" lines (Andi), mention aligning function code with stub Fixes: 91888b5b1ad2 ("drm/i915/dp: Add support for DP tunnel BW allocation") Cc: Imre Deak Cc: # v6.9+ 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++;