From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 25724A0C4B; Fri, 19 Nov 2021 10:34:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4FFE40143; Fri, 19 Nov 2021 10:34:19 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id F2A0540140; Fri, 19 Nov 2021 10:34:17 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10172"; a="258178775" X-IronPort-AV: E=Sophos;i="5.87,246,1631602800"; d="scan'208";a="258178775" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2021 01:34:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,246,1631602800"; d="scan'208";a="594178781" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga002.fm.intel.com with ESMTP; 19 Nov 2021 01:34:16 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 19 Nov 2021 01:34:16 -0800 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 19 Nov 2021 01:34:16 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 19 Nov 2021 01:34:15 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.105) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Fri, 19 Nov 2021 01:34:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L3NHyWbJaujiV3bOijJ7LPfhmOvFyG0z+vcy2G+ge3bacXzsFx0wd/3dM8+mKNcct9AgROEdeAethkKCSaKvI9YTKEr3aweXIycGRqF4zuM2mwpfw21YC08Z0GZGWtZ5jzwebi0zPkggPLxJk2mVPHnQ6msXmj6EN6TNLZiPhe6AhbiFLgGcVSgPKIq+Xd860uT6Qbl22QWNbfXlpnsrmxKdRISmyIDnS+smpYtS18w6T7TcGrBbwCtWdwCk0zsU7GWouiu6QtNXwIfhdU7j830vnyozabYT75XAdz7PklUFc+SCiCk3qokVTnzF0mcxynavS/TQ4ccmkOFB6PCnJQ== 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=0ZX7NEWPWOd1W/8voYZkYLKCl7zkcGLkb04Zcjx9AcM=; b=GKBVf/Ota3WJyT0JSZtX/EkSqmomnSfO58v6VYR1gHUFHUK60m/NsQkJclQXxIGAbaytMsYeCrvH2eSXluODotdoCnKeNVk/6rExlMcPnQRjZDyBr4RAyVVpAjBmKYev9EPugGzLFxpl0nWqYxM40ourUK+9bnaTTmiDTerBx3UeVMuyzrBM+C9+MHPMNmntkh3HBS0JhuMsTcBbOajnhm3wx8PuuhafVH3eCXcxdIqWPDUriwFXobit3C3mzXKyKdxfEi/sW7KGYxTY76u6z6sOX3/bkp7f/UIO3NxWhZpeCWuYsC7bkUCzS4O/byJe+pyRQD7i7I+W98AKeWLXHw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ZX7NEWPWOd1W/8voYZkYLKCl7zkcGLkb04Zcjx9AcM=; b=fAY91MfuyJbdERF/wLO/kigANT053sULb5NCzj9kJEaUAXC4I8vqOEoRGsnmHNH5LaBvDxllxyWrltEtdVsuKHq7mZus+sHT5ft+0U1l+FkrXzO5elsipwiI5tck1HEqkgfPreF141rWv2wTQXLRzQ5aB5teSkuMbOyx339pGwo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Fri, 19 Nov 2021 09:34:14 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bc5f:31a7:10ad:443c]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bc5f:31a7:10ad:443c%5]) with mapi id 15.20.4690.028; Fri, 19 Nov 2021 09:34:14 +0000 Message-ID: Date: Fri, 19 Nov 2021 09:34:08 +0000 Content-Language: en-US To: Tyler Retzlaff , CC: , "techboard@dpdk.org" , "Andrew Rybchenko" , David Marchand References: <20211118192802.23955-1-eagostini@nvidia.com> <20211118201931.GA6492@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> From: Ferruh Yigit Subject: Re: [PATCH v1] gpudev: return EINVAL if invalid input pointer for free and unregister X-User: ferruhy In-Reply-To: <20211118201931.GA6492@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DB3PR08CA0027.eurprd08.prod.outlook.com (2603:10a6:8::40) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by DB3PR08CA0027.eurprd08.prod.outlook.com (2603:10a6:8::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Fri, 19 Nov 2021 09:34:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 555a3001-59d0-47ab-e23c-08d9ab3fbff7 X-MS-TrafficTypeDiagnostic: PH0PR11MB5000: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: idUwGRLkgnNLYHOi6mi5yk6/9ih2z/AWXUb5OUWqeQxjsuWABD1/j6Q3J9il4G9ChIu5fh/owa1T4OGVTxK4VKwklfZezIxGwZWOMLYBqLkL/FsrCUnbcFwDXbme0mFj5fFGOxcAdeCWryp9UO+Ipwq098rswBUUQPPQbjTxa6aifGT76f/ppt46RhkNUfei3YifyyI74GAp0LDDLY7P+poK8RaAxa72mXL0QrKWiMT2+DrbGd7gSa4yESlNdJi2cjc8sxOlTXMW31TGuwhRLVt9htVzdyk3uH+TmhW7djvkyM6+UMUYpMHtPqjlwunp9U8aUndf1Gd5ZANJ8khEX7gTCFhQcA1paPP7bq2EeUBPUXMaLgCmaZfF0GHs/er7mrb50nbKF+poc9006B4ArWfuYT+WnVTsaxj/Dk998LTIXLmQQcZzH/grTXdsdFQE3j1w/DrUnh0higwCONUb2cSNRaN0J7D3FRqa6MZs1CMTSOYYJmFOlVCq8wFp8XPhl3NZIVDlMek18XRWxU0HEUIDBp/xpSgv+gB5ii1w45vUng5/DheWlU6BVAEA7mNtjDfC0rrQ1QG16D12hXYkpH0nBPFBugHWpHbhB/DO2xjrayq5rVO1biw8tkeePFseJTYuvxJsDFnK0U66kX7gY39KQ0HDhyjWJPqn72PAIqgLIxp4lUbAxb5DMeKly23qky5dNwfCUGLhHfmg+mRbiq9GybR14T8Qa/Qs/Ym+oAE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(956004)(82960400001)(26005)(508600001)(8936002)(8676002)(53546011)(31686004)(38100700002)(6666004)(5660300002)(31696002)(2906002)(83380400001)(44832011)(66946007)(16576012)(66476007)(54906003)(66556008)(6486002)(316002)(2616005)(86362001)(4326008)(36756003)(186003)(4533004)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?T0Y0dDUrMzdkSC9RT0xHR2R0ZlJ1V3ZSOUdkNllQbllJS0FYVXNJa1lkZU9H?= =?utf-8?B?bXU0WnpXTVZyT012aXFKcXVheVV0QnVnUTZyL082Nmd2Q3RFL0x0VUcxL004?= =?utf-8?B?c2hjTTNVRXdrdUZENllMek9rQmVYU1VRMmh0enRnbjRBakZ0M2pNbW5ENG9x?= =?utf-8?B?YU9sMDQvL2NwRFZqRVVqdDRqYzVoelJPT1kyV2R6KzVDRUtlZlZ4SW1qYXhR?= =?utf-8?B?SmhXTW13ZU4yd0tHd2llVnBhR2xtN3lML29oSVRpTU40c3NjTTNKSWMxY1Ey?= =?utf-8?B?TGFzT2FuQXg0WSswZnJ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ElBU1Aw?= =?utf-8?B?Mk80aG5hMjBwK1J1SGhXNUZtNE5tWCthWDk5Z0M0R2Q1VHQ0a1ZwTGM3Z1hT?= =?utf-8?Q?PR4VmZf3LiCkELLqhNv/5ZU=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 555a3001-59d0-47ab-e23c-08d9ab3fbff7 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 09:34:14.3978 (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: ehLTg4ZW0qKmldjZZm+GP2Ha7zjphYrBvN7Iyw81iKYWGddqiSh4Nes23Od1Qy70Jv+ShYV5aoN1Wf7OJgII2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5000 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 11/18/2021 8:19 PM, Tyler Retzlaff wrote: > On Thu, Nov 18, 2021 at 07:28:02PM +0000, eagostini@nvidia.com wrote: >> From: Elena Agostini >> >> Signed-off-by: Elena Agostini >> --- >> lib/gpudev/gpudev.c | 10 ++++++++++ >> lib/gpudev/rte_gpudev.h | 2 ++ >> 2 files changed, 12 insertions(+) >> >> diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c >> index 2b174d8bd5..97575ed979 100644 >> --- a/lib/gpudev/gpudev.c >> +++ b/lib/gpudev/gpudev.c >> @@ -576,6 +576,11 @@ rte_gpu_mem_free(int16_t dev_id, void *ptr) >> return -rte_errno; >> } >> >> + if (ptr == NULL) { >> + rte_errno = EINVAL; >> + return -rte_errno; >> + } > > in general dpdk has real problems with how it indicates that an error > occurred and what error occurred consistently. > > some api's return 0 on success > and maybe return -errno if ! 0 > and maybe return errno if ! 0 > and maybe set rte_errno if ! 0 > > some api's return -1 on failure > and set rte_errno if -1 > > some api's return < 0 on failure > and maybe set rte_errno > and maybe return -errno > and maybe set rte_errno and return -rte_errno > This is a generic comment, cc'ed a few more folks to make the comment more visible. > this isn't isiolated to only this change but since additions and context > in this patch highlight it maybe it's a good time to bring it up. > > it's frustrating to have to carefully read the implementation every time > you want to make a function call to make sure you're handling the flavor > of error reporting for a particular function. > > if this is new code could we please clearly identify the current best > practice and follow it as a standard going forward for all new public > apis. > > thanks! >