* [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
@ 2019-11-18 11:46 zhengbin
2019-11-18 11:46 ` [PATCH 1/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_bo_dumb_create zhengbin
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: zhengbin @ 2019-11-18 11:46 UTC (permalink / raw)
To: treding, airlied, daniel, jonathanh, dri-devel, linux-tegra; +Cc: zhengbin13
zhengbin (2):
drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in
tegra_bo_dumb_create
drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create
drivers/gpu/drm/tegra/drm.c | 5 +----
drivers/gpu/drm/tegra/gem.c | 5 +----
2 files changed, 2 insertions(+), 8 deletions(-)
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_bo_dumb_create
2019-11-18 11:46 [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code zhengbin
@ 2019-11-18 11:46 ` zhengbin
2019-11-18 11:46 ` [PATCH 2/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create zhengbin
2019-11-18 13:23 ` [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code Thierry Reding
2 siblings, 0 replies; 7+ messages in thread
From: zhengbin @ 2019-11-18 11:46 UTC (permalink / raw)
To: treding, airlied, daniel, jonathanh, dri-devel, linux-tegra; +Cc: zhengbin13
Fixes coccicheck warning:
drivers/gpu/drm/tegra/gem.c:457:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
drivers/gpu/drm/tegra/gem.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 746dae3..dae3efe 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -454,10 +454,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)
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create
2019-11-18 11:46 [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code zhengbin
2019-11-18 11:46 ` [PATCH 1/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_bo_dumb_create zhengbin
@ 2019-11-18 11:46 ` zhengbin
2019-11-18 13:23 ` [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code Thierry Reding
2 siblings, 0 replies; 7+ messages in thread
From: zhengbin @ 2019-11-18 11:46 UTC (permalink / raw)
To: treding, airlied, daniel, jonathanh, dri-devel, linux-tegra; +Cc: zhengbin13
Fixes coccicheck warning:
drivers/gpu/drm/tegra/drm.c:350:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
drivers/gpu/drm/tegra/drm.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 56e5e7a..8b6a1f7d 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -347,10 +347,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,
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
2019-11-18 11:46 [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code zhengbin
2019-11-18 11:46 ` [PATCH 1/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_bo_dumb_create zhengbin
2019-11-18 11:46 ` [PATCH 2/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create zhengbin
@ 2019-11-18 13:23 ` Thierry Reding
2019-11-19 11:44 ` Jani Nikula
2 siblings, 1 reply; 7+ messages in thread
From: Thierry Reding @ 2019-11-18 13:23 UTC (permalink / raw)
To: zhengbin; +Cc: airlied, dri-devel, jonathanh, linux-tegra, treding
[-- Attachment #1.1: Type: text/plain, Size: 506 bytes --]
On Mon, Nov 18, 2019 at 07:46:10PM +0800, zhengbin wrote:
> zhengbin (2):
> drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in
> tegra_bo_dumb_create
> drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create
>
> drivers/gpu/drm/tegra/drm.c | 5 +----
> drivers/gpu/drm/tegra/gem.c | 5 +----
> 2 files changed, 2 insertions(+), 8 deletions(-)
As I explained in response to the same patches sent for other drivers
already, I don't think this has any merit.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
2019-11-18 13:23 ` [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code Thierry Reding
@ 2019-11-19 11:44 ` Jani Nikula
2019-11-19 11:52 ` Jani Nikula
0 siblings, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2019-11-19 11:44 UTC (permalink / raw)
To: Thierry Reding, zhengbin, Julia Lawall
Cc: airlied, dri-devel, jonathanh, linux-tegra, treding
On Mon, 18 Nov 2019, Thierry Reding <thierry.reding@gmail.com> wrote:
> On Mon, Nov 18, 2019 at 07:46:10PM +0800, zhengbin wrote:
>> zhengbin (2):
>> drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in
>> tegra_bo_dumb_create
>> drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create
>>
>> drivers/gpu/drm/tegra/drm.c | 5 +----
>> drivers/gpu/drm/tegra/gem.c | 5 +----
>> 2 files changed, 2 insertions(+), 8 deletions(-)
>
> As I explained in response to the same patches sent for other drivers
> already, I don't think this has any merit.
I agree completely.
Apparently there's a coccicheck flagging constructs like this; perhaps
that should be addressed. Julia?
Things like:
drivers/gpu/drm/tegra/gem.c:457:1-3: WARNING: PTR_ERR_OR_ZERO can be used
leading to:
- if (IS_ERR(bo))
- return PTR_ERR(bo);
-
- return 0;
+ return PTR_ERR_OR_ZERO(bo);
I think we have consensus the error path and the happy day scenarios
should remain distinct. Moreover, I find PTR_ERR_OR_ZERO() causes me to
pause for a moment while the original is a crystal clear immediately.
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
2019-11-19 11:44 ` Jani Nikula
@ 2019-11-19 11:52 ` Jani Nikula
2019-11-19 12:40 ` Julia Lawall
0 siblings, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2019-11-19 11:52 UTC (permalink / raw)
To: Thierry Reding, zhengbin, Julia Lawall
Cc: airlied, dri-devel, jonathanh, Tomi Valkeinen, linux-tegra,
treding
On Tue, 19 Nov 2019, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Mon, 18 Nov 2019, Thierry Reding <thierry.reding@gmail.com> wrote:
>> On Mon, Nov 18, 2019 at 07:46:10PM +0800, zhengbin wrote:
>>> zhengbin (2):
>>> drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in
>>> tegra_bo_dumb_create
>>> drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create
>>>
>>> drivers/gpu/drm/tegra/drm.c | 5 +----
>>> drivers/gpu/drm/tegra/gem.c | 5 +----
>>> 2 files changed, 2 insertions(+), 8 deletions(-)
>>
>> As I explained in response to the same patches sent for other drivers
>> already, I don't think this has any merit.
>
> I agree completely.
>
> Apparently there's a coccicheck flagging constructs like this; perhaps
> that should be addressed. Julia?
>
> Things like:
>
> drivers/gpu/drm/tegra/gem.c:457:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
> leading to:
>
> - if (IS_ERR(bo))
> - return PTR_ERR(bo);
> -
> - return 0;
> + return PTR_ERR_OR_ZERO(bo);
>
> I think we have consensus the error path and the happy day scenarios
> should remain distinct. Moreover, I find PTR_ERR_OR_ZERO() causes me to
> pause for a moment while the original is a crystal clear immediately.
Re consensus, [1][2] and probably more. Per an email search, this pops
up for the same stuff over and over again. Can we please just remove the
cocci check?
BR,
Jani.
[1] http://mid.mail-archive.com/daade52d-0dfc-9365-b17c-02e7e785afad@ti.com
[2] http://mid.mail-archive.com/20191118130022.GM4345@gilmour.lan
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
2019-11-19 11:52 ` Jani Nikula
@ 2019-11-19 12:40 ` Julia Lawall
0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2019-11-19 12:40 UTC (permalink / raw)
To: Jani Nikula
Cc: airlied, Tomi Valkeinen, dri-devel, jonathanh, zhengbin,
Thierry Reding, linux-tegra, treding
On Tue, 19 Nov 2019, Jani Nikula wrote:
> On Tue, 19 Nov 2019, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> > On Mon, 18 Nov 2019, Thierry Reding <thierry.reding@gmail.com> wrote:
> >> On Mon, Nov 18, 2019 at 07:46:10PM +0800, zhengbin wrote:
> >>> zhengbin (2):
> >>> drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in
> >>> tegra_bo_dumb_create
> >>> drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create
> >>>
> >>> drivers/gpu/drm/tegra/drm.c | 5 +----
> >>> drivers/gpu/drm/tegra/gem.c | 5 +----
> >>> 2 files changed, 2 insertions(+), 8 deletions(-)
> >>
> >> As I explained in response to the same patches sent for other drivers
> >> already, I don't think this has any merit.
> >
> > I agree completely.
> >
> > Apparently there's a coccicheck flagging constructs like this; perhaps
> > that should be addressed. Julia?
> >
> > Things like:
> >
> > drivers/gpu/drm/tegra/gem.c:457:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> >
> > leading to:
> >
> > - if (IS_ERR(bo))
> > - return PTR_ERR(bo);
> > -
> > - return 0;
> > + return PTR_ERR_OR_ZERO(bo);
> >
> > I think we have consensus the error path and the happy day scenarios
> > should remain distinct. Moreover, I find PTR_ERR_OR_ZERO() causes me to
> > pause for a moment while the original is a crystal clear immediately.
>
> Re consensus, [1][2] and probably more. Per an email search, this pops
> up for the same stuff over and over again. Can we please just remove the
> cocci check?
OK.
julia
>
> BR,
> Jani.
>
>
> [1] http://mid.mail-archive.com/daade52d-0dfc-9365-b17c-02e7e785afad@ti.com
> [2] http://mid.mail-archive.com/20191118130022.GM4345@gilmour.lan
>
> --
> Jani Nikula, Intel Open Source Graphics Center
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-19 12:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-18 11:46 [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code zhengbin
2019-11-18 11:46 ` [PATCH 1/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_bo_dumb_create zhengbin
2019-11-18 11:46 ` [PATCH 2/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create zhengbin
2019-11-18 13:23 ` [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code Thierry Reding
2019-11-19 11:44 ` Jani Nikula
2019-11-19 11:52 ` Jani Nikula
2019-11-19 12:40 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).