linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Fix smatch warnings
@ 2019-03-25 22:03 Mauro Carvalho Chehab
  2019-03-25 22:03 ` [PATCH 4/5] media: rcar-dma: p_set can't be NULL Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2019-03-25 22:03 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Hans Verkuil, Stanimir Varbanov,
	linux-renesas-soc, Andy Gross, Niklas Söderlund,
	David Brown, Hugues Fruchet, linux-arm-msm

Fix smatch warnings on media subsystem.

Mauro Carvalho Chehab (5):
  media: cx2341x: replace badly designed macros
  media: pwc-ctl: pChoose can't be NULL
  media: sti/delta: remove uneeded check
  media: rcar-dma: p_set can't be NULL
  media: hfi_parser: don't trick gcc with a wrong expected size

 drivers/media/common/cx2341x.c                | 151 +++++++++++-------
 .../media/platform/qcom/venus/hfi_helper.h    |   4 +-
 drivers/media/platform/rcar-vin/rcar-dma.c    |   2 +-
 drivers/media/platform/sti/delta/delta-ipc.c  |   6 +-
 drivers/media/usb/pwc/pwc-ctrl.c              |  17 +-
 5 files changed, 107 insertions(+), 73 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 4/5] media: rcar-dma: p_set can't be NULL
  2019-03-25 22:03 [PATCH 0/5] Fix smatch warnings Mauro Carvalho Chehab
@ 2019-03-25 22:03 ` Mauro Carvalho Chehab
  2019-03-26  8:55   ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2019-03-25 22:03 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Niklas Söderlund, linux-renesas-soc

The only way for p_set to be NULL would be if vin_coef_set would be an
empty array.

On such case, the driver will OOPS, as it would try to de-reference a
NULL value. So, the check if p_set is not NULL doesn't make any sense.

Solves those two smatch warnings:

	drivers/media/platform/rcar-vin/rcar-dma.c:489 rvin_set_coeff() warn: variable dereferenced before check 'p_set' (see line 484)
	drivers/media/platform/rcar-vin/rcar-dma.c:494 rvin_set_coeff() error: we previously assumed 'p_set' could be null (see line 489)

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 drivers/media/platform/rcar-vin/rcar-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index 2207a31d355e..91ab064404a1 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -486,7 +486,7 @@ static void rvin_set_coeff(struct rvin_dev *vin, unsigned short xs)
 	}
 
 	/* Use previous value if its XS value is closer */
-	if (p_prev_set && p_set &&
+	if (p_prev_set &&
 	    xs - p_prev_set->xs_value < p_set->xs_value - xs)
 		p_set = p_prev_set;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/5] media: rcar-dma: p_set can't be NULL
  2019-03-25 22:03 ` [PATCH 4/5] media: rcar-dma: p_set can't be NULL Mauro Carvalho Chehab
@ 2019-03-26  8:55   ` Sergei Shtylyov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2019-03-26  8:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Linux Media Mailing List, Mauro Carvalho Chehab,
	Niklas Söderlund, linux-renesas-soc

Hello!

    I'd have used instead (or at least mentioned) the driver's name (rcar-vin) 
in the subject.

On 26.03.2019 1:03, Mauro Carvalho Chehab wrote:
> The only way for p_set to be NULL would be if vin_coef_set would be an
> empty array.
> 
> On such case, the driver will OOPS, as it would try to de-reference a
> NULL value. So, the check if p_set is not NULL doesn't make any sense.
> 
> Solves those two smatch warnings:
> 
> 	drivers/media/platform/rcar-vin/rcar-dma.c:489 rvin_set_coeff() warn: variable dereferenced before check 'p_set' (see line 484)
> 	drivers/media/platform/rcar-vin/rcar-dma.c:494 rvin_set_coeff() error: we previously assumed 'p_set' could be null (see line 489)
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> ---
>   drivers/media/platform/rcar-vin/rcar-dma.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
> index 2207a31d355e..91ab064404a1 100644
> --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> @@ -486,7 +486,7 @@ static void rvin_set_coeff(struct rvin_dev *vin, unsigned short xs)
>   	}
>   
>   	/* Use previous value if its XS value is closer */
> -	if (p_prev_set && p_set &&
> +	if (p_prev_set &&
>   	    xs - p_prev_set->xs_value < p_set->xs_value - xs)
>   		p_set = p_prev_set;
>   

MBR, Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-26  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 22:03 [PATCH 0/5] Fix smatch warnings Mauro Carvalho Chehab
2019-03-25 22:03 ` [PATCH 4/5] media: rcar-dma: p_set can't be NULL Mauro Carvalho Chehab
2019-03-26  8:55   ` Sergei Shtylyov

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).