* [PATCH] media: hantro: remove a pointless NULL check
@ 2020-01-08 5:35 Dan Carpenter
2020-01-08 15:08 ` Ezequiel Garcia
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2020-01-08 5:35 UTC (permalink / raw)
To: Ezequiel Garcia
Cc: devel, Greg Kroah-Hartman, Mauro Carvalho Chehab,
kernel-janitors, linux-media
This can't be NULL and we've already dereferenced it so let's remove
the check.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/staging/media/hantro/hantro_v4l2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
index 85af1b96fd34..0198bcda26b7 100644
--- a/drivers/staging/media/hantro/hantro_v4l2.c
+++ b/drivers/staging/media/hantro/hantro_v4l2.c
@@ -688,7 +688,7 @@ static int hantro_start_streaming(struct vb2_queue *q, unsigned int count)
return ret;
err_codec_exit:
- if (ctx->codec_ops && ctx->codec_ops->exit)
+ if (ctx->codec_ops->exit)
ctx->codec_ops->exit(ctx);
return ret;
}
--
2.11.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] media: hantro: remove a pointless NULL check
2020-01-08 5:35 [PATCH] media: hantro: remove a pointless NULL check Dan Carpenter
@ 2020-01-08 15:08 ` Ezequiel Garcia
2020-01-08 15:18 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Ezequiel Garcia @ 2020-01-08 15:08 UTC (permalink / raw)
To: Dan Carpenter
Cc: devel, Greg Kroah-Hartman, Mauro Carvalho Chehab,
kernel-janitors, linux-media
Hi Dan,
Thanks for the patch.
On Wed, 2020-01-08 at 08:35 +0300, Dan Carpenter wrote:
> This can't be NULL and we've already dereferenced it so let's remove
> the check.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/staging/media/hantro/hantro_v4l2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
> index 85af1b96fd34..0198bcda26b7 100644
> --- a/drivers/staging/media/hantro/hantro_v4l2.c
> +++ b/drivers/staging/media/hantro/hantro_v4l2.c
> @@ -688,7 +688,7 @@ static int hantro_start_streaming(struct vb2_queue *q, unsigned int count)
> return ret;
>
> err_codec_exit:
> - if (ctx->codec_ops && ctx->codec_ops->exit)
> + if (ctx->codec_ops->exit)
Since you are here, can you remove the other unneeded
checks in the driver?
We are assuming ctx->codec_op is non-NULL, so perhaps
a check in .probe, to check it explicitly would be better.
Thanks,
Ezequiel
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: hantro: remove a pointless NULL check
2020-01-08 15:08 ` Ezequiel Garcia
@ 2020-01-08 15:18 ` Dan Carpenter
2020-01-08 15:24 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2020-01-08 15:18 UTC (permalink / raw)
To: Ezequiel Garcia
Cc: devel, Greg Kroah-Hartman, Mauro Carvalho Chehab,
kernel-janitors, linux-media
On Wed, Jan 08, 2020 at 12:08:21PM -0300, Ezequiel Garcia wrote:
> Hi Dan,
>
> Thanks for the patch.
>
> On Wed, 2020-01-08 at 08:35 +0300, Dan Carpenter wrote:
> > This can't be NULL and we've already dereferenced it so let's remove
> > the check.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > drivers/staging/media/hantro/hantro_v4l2.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
> > index 85af1b96fd34..0198bcda26b7 100644
> > --- a/drivers/staging/media/hantro/hantro_v4l2.c
> > +++ b/drivers/staging/media/hantro/hantro_v4l2.c
> > @@ -688,7 +688,7 @@ static int hantro_start_streaming(struct vb2_queue *q, unsigned int count)
> > return ret;
> >
> > err_codec_exit:
> > - if (ctx->codec_ops && ctx->codec_ops->exit)
> > + if (ctx->codec_ops->exit)
>
> Since you are here, can you remove the other unneeded
> checks in the driver?
>
There is only one more, but yes, I should remove it as well.
> We are assuming ctx->codec_op is non-NULL, so perhaps
> a check in .probe, to check it explicitly would be better.
It's the address from inside the middle of a struct so it can't possibly
be NULL. No need to check.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: hantro: remove a pointless NULL check
2020-01-08 15:18 ` Dan Carpenter
@ 2020-01-08 15:24 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-01-08 15:24 UTC (permalink / raw)
To: Ezequiel Garcia
Cc: devel, Greg Kroah-Hartman, Mauro Carvalho Chehab,
kernel-janitors, linux-media
On Wed, Jan 08, 2020 at 06:18:09PM +0300, Dan Carpenter wrote:
> On Wed, Jan 08, 2020 at 12:08:21PM -0300, Ezequiel Garcia wrote:
> > Hi Dan,
> >
> > Thanks for the patch.
> >
> > On Wed, 2020-01-08 at 08:35 +0300, Dan Carpenter wrote:
> > > This can't be NULL and we've already dereferenced it so let's remove
> > > the check.
> > >
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > ---
> > > drivers/staging/media/hantro/hantro_v4l2.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
> > > index 85af1b96fd34..0198bcda26b7 100644
> > > --- a/drivers/staging/media/hantro/hantro_v4l2.c
> > > +++ b/drivers/staging/media/hantro/hantro_v4l2.c
> > > @@ -688,7 +688,7 @@ static int hantro_start_streaming(struct vb2_queue *q, unsigned int count)
> > > return ret;
> > >
> > > err_codec_exit:
> > > - if (ctx->codec_ops && ctx->codec_ops->exit)
> > > + if (ctx->codec_ops->exit)
> >
> > Since you are here, can you remove the other unneeded
> > checks in the driver?
> >
>
> There is only one more, but yes, I should remove it as well.
Actually the other check is required.
Let's just leave this one as well. It doesn't hurt anything and it
makes the code more future proof.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-08 15:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 5:35 [PATCH] media: hantro: remove a pointless NULL check Dan Carpenter
2020-01-08 15:08 ` Ezequiel Garcia
2020-01-08 15:18 ` Dan Carpenter
2020-01-08 15:24 ` Dan Carpenter
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).