[PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
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
Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
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 signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
On Mon, 18 Nov 2019, Thierry Reding 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
Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
On Tue, 19 Nov 2019, Jani Nikula wrote: > On Mon, 18 Nov 2019, Thierry Reding 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] daade52d-0dfc-9365-b17c-02e7e785afad@ti.com">http://mid.mail-archive.com/daade52d-0dfc-9365-b17c-02e7e785afad@ti.com [2] 20191118130022.GM4345@gilmour.lan">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
Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
On Tue, 19 Nov 2019, Jani Nikula wrote: > On Tue, 19 Nov 2019, Jani Nikula wrote: > > On Mon, 18 Nov 2019, Thierry Reding 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] daade52d-0dfc-9365-b17c-02e7e785afad@ti.com">http://mid.mail-archive.com/daade52d-0dfc-9365-b17c-02e7e785afad@ti.com > [2] 20191118130022.GM4345@gilmour.lan">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