All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Jacopo Mondi <jacopo@jmondi.org>
Subject: [PATCH 4/8] media: platform: renesas-ceu: drop buf NULL check
Date: Wed, 24 May 2023 14:11:46 +0200	[thread overview]
Message-ID: <20230524121150.435736-5-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20230524121150.435736-1-hverkuil-cisco@xs4all.nl>

Since start_streaming is only called if there are at least two
buffers queued, the ceudev->capture list will never be empty, so
the check whether there are no buffers can be dropped.

Note that the '!buf' check was wrong in any case, if we wanted to
check for an empty list it should have used list_empty().

This fixes this smatch warning:

drivers/media/platform/renesas/renesas-ceu.c:705 ceu_start_streaming() warn: can 'buf' even be NULL?

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Jacopo Mondi <jacopo@jmondi.org>
---
 drivers/media/platform/renesas/renesas-ceu.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/media/platform/renesas/renesas-ceu.c b/drivers/media/platform/renesas/renesas-ceu.c
index 56b9c59cfda8..5c9e27f8c94b 100644
--- a/drivers/media/platform/renesas/renesas-ceu.c
+++ b/drivers/media/platform/renesas/renesas-ceu.c
@@ -702,12 +702,6 @@ static int ceu_start_streaming(struct vb2_queue *vq, unsigned int count)
 	/* Grab the first available buffer and trigger the first capture. */
 	buf = list_first_entry(&ceudev->capture, struct ceu_buffer,
 			       queue);
-	if (!buf) {
-		spin_unlock_irqrestore(&ceudev->lock, irqflags);
-		dev_dbg(ceudev->dev,
-			"No buffer available for capture.\n");
-		goto error_stop_sensor;
-	}
 
 	list_del(&buf->queue);
 	ceudev->active = &buf->vb;
@@ -722,9 +716,6 @@ static int ceu_start_streaming(struct vb2_queue *vq, unsigned int count)
 
 	return 0;
 
-error_stop_sensor:
-	v4l2_subdev_call(v4l2_sd, video, s_stream, 0);
-
 error_return_bufs:
 	spin_lock_irqsave(&ceudev->lock, irqflags);
 	list_for_each_entry(buf, &ceudev->capture, queue)
-- 
2.39.2


  parent reply	other threads:[~2023-05-24 12:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 12:11 [PATCH 0/8] Various smatch/sparse fixes Hans Verkuil
2023-05-24 12:11 ` [PATCH 1/8] staging: media: atomisp: initialize settings to 0 Hans Verkuil
2023-05-24 16:04   ` Hans de Goede
2023-05-25  7:18     ` Hans Verkuil
2023-05-24 12:11 ` [PATCH 2/8] media: rockchip: rga: fix clock cleanup Hans Verkuil
2023-05-25  8:17   ` Michael Tretter
2023-05-24 12:11 ` [PATCH 3/8] media: usb: as102: drop as102_dev NULL check Hans Verkuil
2023-05-24 12:11 ` Hans Verkuil [this message]
2023-05-25 13:43   ` [PATCH 4/8] media: platform: renesas-ceu: drop buf " Jacopo Mondi
2023-05-24 12:11 ` [PATCH 5/8] media: platform: mediatek: vpu: fix NULL ptr dereference Hans Verkuil
2023-05-24 12:11 ` [PATCH 6/8] media: mediatek: vpu: add missing clk_unprepare Hans Verkuil
2023-05-24 12:11 ` [PATCH 7/8] media: pci: tw686x: no need to check 'next' Hans Verkuil
2023-05-24 12:11 ` [PATCH 8/8] staging: media: atomisp: move up sanity checks Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230524121150.435736-5-hverkuil-cisco@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.