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 77245A0C41; Thu, 18 Nov 2021 17:21:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64CC440687; Thu, 18 Nov 2021 17:21:03 +0100 (CET) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id CA79040395 for ; Thu, 18 Nov 2021 17:21:01 +0100 (CET) Received: by mail-pj1-f46.google.com with SMTP id x7so5574620pjn.0 for ; Thu, 18 Nov 2021 08:21:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WnwrYYQb1p3w5Cmn2BZ6W8YT9ARwkFzlUxyigJ0VqJc=; b=zYKVJG4RWVZ7l7u6VzJAIoIthLXW5Qw2y0auw+juoGAIlujuxJfXMRM1JN2c7r+nUs hIiMUCSvFvXzYELGyyOaAje+kSUxvIj16I/Qwwv2cAqWVheNuTdqCRJDw3rlhGb5G1au IW4bwaytYS/lzzMJj3Kp5Srnr4HOmhhiZ6ZkYuP3vs+VukDe1feMvaS8Pyy555dfk8Oq j/Azj2ehx2pafZRwiYwRNJyydC7+xdNbfCw1GC/kggN8zNWCcxEBMkWXAZArkcIfXNZG yRd8E+6n8MKrkrqMBsl7unocK6nPKQqmd0GQ+6hBoAeRtpge905vGGsAw+drVpeYn/7O WEHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WnwrYYQb1p3w5Cmn2BZ6W8YT9ARwkFzlUxyigJ0VqJc=; b=TCL+G7WvPyWP3WZDssfg/1RoPCunVv/va2lpSh7+Km0F4Ixx5zHRZQ4j1mn/H7XnA0 dtMXwxm2jdsj0pI1bO/WB5OOvwblON5C2wTOxAN/A2OaTgstgvw6HPN9b32CWktblvKu 2PDdMbc+xAFh9w9ISJGxGatpSO3jOMDveho4/1a/J/iBm6HiwAXgeDh8Wn+KswxppxO0 9fdJkBUbtxh5wH50oq3g3v+JRYeymNQV2orPXnPL1UimGloPP9Q57IzxrRklZ59ljJ/Q fp8XynM3FNo2sH9BQyFOEn1ceXOaww2C/V0lp7aXAkBxaMkCv5M/PKgimwthK/e5yNrb Kbsw== X-Gm-Message-State: AOAM531fJhHklccdG2b0MNA1fV/S1d3vm7bpLM6/SrpS0a2mWwV1U8pX kRUqjp9D6kFySCV+tMHur65CZA== X-Google-Smtp-Source: ABdhPJynEGm1Uv22ZWln+ZR1D9J6UpnJI08QrXorDh858KqftUc1uzhG40eGM3mei4GHYUDCz0gWOg== X-Received: by 2002:a17:902:7d96:b0:142:87dc:7dd3 with SMTP id a22-20020a1709027d9600b0014287dc7dd3mr67026989plm.11.1637252460804; Thu, 18 Nov 2021 08:21:00 -0800 (PST) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id ne7sm8644165pjb.36.2021.11.18.08.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 08:21:00 -0800 (PST) Date: Thu, 18 Nov 2021 08:20:57 -0800 From: Stephen Hemminger To: Cc: Subject: Re: [PATCH v1] gpudev: return EINVAL if invalid input pointer for free and unregister Message-ID: <20211118082057.55cbfc28@hermes.local> In-Reply-To: <20211118192802.23955-1-eagostini@nvidia.com> References: <20211118192802.23955-1-eagostini@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Thu, 18 Nov 2021 19:28:02 +0000 wrote: > 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; > + } > + The convention for free(), and rte_free() is that calling free with a NULL pointer is a nop. Why not follow those? This would keep programmers from having to view GPU as a special case.