diff mbox series

[v1] drm/shmem-helper: Correct doc-comment of drm_gem_shmem_get_sg_table()

Message ID 20220308133401.62340-1-dmitry.osipenko@collabora.com (mailing list archive)
State New, archived
Headers show
Series [v1] drm/shmem-helper: Correct doc-comment of drm_gem_shmem_get_sg_table() | expand

Commit Message

Dmitry Osipenko March 8, 2022, 1:34 p.m. UTC
drm_gem_shmem_get_sg_table() never returns NULL on error, but a ERR_PTR.
Correct the doc comment which says that it returns NULL on error.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Vetter March 17, 2022, 9:52 a.m. UTC | #1
On Tue, Mar 08, 2022 at 04:34:01PM +0300, Dmitry Osipenko wrote:
> drm_gem_shmem_get_sg_table() never returns NULL on error, but a ERR_PTR.
> Correct the doc comment which says that it returns NULL on error.
> 
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> ---
>  drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
> index 8ad0e02991ca..37009418cd28 100644
> --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
> +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
> @@ -662,7 +662,7 @@ EXPORT_SYMBOL(drm_gem_shmem_print_info);
>   * drm_gem_shmem_get_pages_sgt() instead.
>   *
>   * Returns:
> - * A pointer to the scatter/gather table of pinned pages or NULL on failure.
> + * A pointer to the scatter/gather table of pinned pages or errno on failure.

Hm usually we write "negative errno" for these, since the error numbers
are defined as positive numbers. Care to respin?

Thanks a lot, Daniel

>   */
>  struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_shmem_object *shmem)
>  {
> -- 
> 2.35.1
>
Dmitry Osipenko March 17, 2022, 10:53 a.m. UTC | #2
On 3/17/22 12:52, Daniel Vetter wrote:
> On Tue, Mar 08, 2022 at 04:34:01PM +0300, Dmitry Osipenko wrote:
>> drm_gem_shmem_get_sg_table() never returns NULL on error, but a ERR_PTR.
>> Correct the doc comment which says that it returns NULL on error.
>>
>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
>> ---
>>  drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
>> index 8ad0e02991ca..37009418cd28 100644
>> --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
>> @@ -662,7 +662,7 @@ EXPORT_SYMBOL(drm_gem_shmem_print_info);
>>   * drm_gem_shmem_get_pages_sgt() instead.
>>   *
>>   * Returns:
>> - * A pointer to the scatter/gather table of pinned pages or NULL on failure.
>> + * A pointer to the scatter/gather table of pinned pages or errno on failure.
> 
> Hm usually we write "negative errno" for these, since the error numbers
> are defined as positive numbers. Care to respin?

It's actually ERR_PTR that is returned here, "errno" was borrowed from
some other similar DRM comment. I added this patch to v2 of virtio
patchset [1] and will improve the comment in v3, thanks.

[1]
https://lore.kernel.org/dri-devel/20220314224253.236359-1-dmitry.osipenko@collabora.com/T/#t
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
index 8ad0e02991ca..37009418cd28 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -662,7 +662,7 @@  EXPORT_SYMBOL(drm_gem_shmem_print_info);
  * drm_gem_shmem_get_pages_sgt() instead.
  *
  * Returns:
- * A pointer to the scatter/gather table of pinned pages or NULL on failure.
+ * A pointer to the scatter/gather table of pinned pages or errno on failure.
  */
 struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_shmem_object *shmem)
 {