[PATCH -next 2/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
Ruan Jinjie
ruanjinjie at huawei.com
Tue Aug 22 12:43:21 UTC 2023
On 2023/8/22 20:32, Mikko Perttunen wrote:
> On 8/22/23 10:15, Jinjie Ruan wrote:
>> Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
>> simplify code.
>>
>> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>
>> ---
>> drivers/gpu/drm/tegra/drm.c | 5 +----
>> drivers/gpu/drm/tegra/gem.c | 5 +----
>> 2 files changed, 2 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
>> index ff36171c8fb7..4e29d76da1be 100644
>> --- a/drivers/gpu/drm/tegra/drm.c
>> +++ b/drivers/gpu/drm/tegra/drm.c
>> @@ -354,10 +354,7 @@ static int tegra_gem_create(struct drm_device
>> *drm, void *data,
>> bo = tegra_bo_create_with_handle(file, drm, args->size,
>> args->flags,
>> &args->handle);
>> - if (IS_ERR(bo))
>> - return PTR_ERR(bo);
>> -
>> - return 0;
>> + return PTR_ERR_OR_ZERO(bo);
>> }
>> static int tegra_gem_mmap(struct drm_device *drm, void *data,
>> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
>> index a4023163493d..11ef0f8cb1e1 100644
>> --- a/drivers/gpu/drm/tegra/gem.c
>> +++ b/drivers/gpu/drm/tegra/gem.c
>> @@ -533,10 +533,7 @@ int tegra_bo_dumb_create(struct drm_file *file,
>> struct drm_device *drm,
>> bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
>> &args->handle);
>> - if (IS_ERR(bo))
>> - return PTR_ERR(bo);
>> -
>> - return 0;
>> + return PTR_ERR_OR_ZERO(bo);
>> }
>> static vm_fault_t tegra_bo_fault(struct vm_fault *vmf)
>
> NAK. See
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20230822&id=b784c77075023e1a71bc06e6b4f711acb99e9c73
Thank you! It is right.
>
> Mikko
More information about the dri-devel
mailing list