From patchwork Thu Nov 9 16:34:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 163477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp558653vqs; Thu, 9 Nov 2023 08:38:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXMVDwid4GtCIt/JtrKal8k7J5RxzapIkjSpwhWuvSyRlfwo42J7UFGCZn5S2iD5t/21kl X-Received: by 2002:aa7:88d6:0:b0:68f:d1a7:1a3a with SMTP id k22-20020aa788d6000000b0068fd1a71a3amr5268074pff.8.1699547905360; Thu, 09 Nov 2023 08:38:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699547905; cv=none; d=google.com; s=arc-20160816; b=wvua7TVClxF4spVA7azwm1XcnWGIHSkKAPHbbRJ5iTmQcqdBuBaINVPc6JRKLI5/RR kl5x6W/4nVYNO+9tuuOMhVvSrG//fbDKDO78UYAjCl2DwXM/dVoedRGbB1cBDBj8JUM2 AsluVlv42kz9u/Sz8GsYFrKEVgA7XXv2q2pT6Y3xY5REJRzE4+eS0Kmpw7JPPphq7PsU KZ4akVKM8Pyt9upDv7ojdyP7Vu0Im3g8FLPzz576vUM3M2omMA8CjPquj7trGpSF6+/0 YMyOBd/TgJ16lKsPp2tkuMo2MiEdiDrfjVr8SAYqfo6M+HS3w02gZ3j1H1uSdwIzpkEF WwSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UNE2NhVSXEPMI8rRmKuC4SF+fa5IUmikIoGx9xx7pjw=; fh=NPTCYP6kV89VhZcTyqjnuKz2OW5UZUbu4oezKHT17AA=; b=WYdSAfr2o2VxucMlpbItwIorS3Y89mOXDExupfjYlUCDAhij0qqXq+Z/s2A3NFvLNb 0mALdrty8JFPucom4G+Bf7NyQpf0CDCuHLuSGT0IMbTpqM6WrZE11yntghZFLIr7fVct KCat5jhPFCm+wBxcSEb0/6g6yF3HLIe+XjW6uuNGkRGOu9z2GxBMiBqXalJOBuyygvId Bqgft5FIDrp4WJF4loeDr+uB32Bo1AdNMo4iY4+x8zzZnNZssqD/y0IupAV4S7Wn/6Vf LD/32NZ2Xmo/3/FTdZiWEFSOKnmjwBW4e48naO4lFA/3giWsIHko4n1fDJc890+y5qHC fTWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=n5GvkQLl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id jc16-20020a056a006c9000b006c0fe1a6e78si16951607pfb.22.2023.11.09.08.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 08:38:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=n5GvkQLl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B35D98245097; Thu, 9 Nov 2023 08:38:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344109AbjKIQho (ORCPT + 31 others); Thu, 9 Nov 2023 11:37:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344171AbjKIQhm (ORCPT ); Thu, 9 Nov 2023 11:37:42 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF56F35BD; Thu, 9 Nov 2023 08:37:39 -0800 (PST) Received: from benjamin-XPS-13-9310.. (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id D7E3666076A5; Thu, 9 Nov 2023 16:37:37 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1699547858; bh=bV0ERtEqdV4yHcsPhAjbGgZ+BzDtJjLwQFzfoOyB/fM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5GvkQLlCM+m4Xl43QcH1akmp7cjecSe3ztlpuCREXLg1uS3msm9Vse6tcCr/pXsM ol5GEKFBMW6gz0UHLPpBld/TQ5obsJKUaQXFTZzddvR8Kxau6yJlFYUpcKggK5tI7u sblcvHwesYLJHGmgOSbLapbg/LR4YyK5elk8xwsRuoy+6W7Zm/Q/Dl+ELC97Yr5q/+ 37KVrPg6reMWapTPKyelhKv47bi1oQwudRqlHaow5RuOXFdeuE46LVmo2ftXoQ8CAZ htwbFEiSDwbAdQuij7SnLGVMv9teO//GHRQd+U06BbqrDh4IT59IQHuYVHUGt4QcIn f3avZvAJTgbnA== From: Benjamin Gaignard To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard , Jean-Christophe Trotin Subject: [PATCH v15 14/56] media: sti: hva: Remove useless check Date: Thu, 9 Nov 2023 17:34:30 +0100 Message-Id: <20231109163512.179524-15-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231109163512.179524-14-benjamin.gaignard@collabora.com> References: <20231109163512.179524-14-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 08:38:17 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782105144554382523 X-GMAIL-MSGID: 1782105144554382523 Remove index range test since it is done by vb2_get_buffer(). vb2_get_buffer() can return a NULL pointer so we need the return value. Signed-off-by: Benjamin Gaignard CC: Jean-Christophe Trotin Reviewed-by: Andrzej Pietrasiewicz --- drivers/media/platform/st/sti/hva/hva-v4l2.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/st/sti/hva/hva-v4l2.c b/drivers/media/platform/st/sti/hva/hva-v4l2.c index 3a848ca32a0e..cfe83e9dc01b 100644 --- a/drivers/media/platform/st/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/st/sti/hva/hva-v4l2.c @@ -569,14 +569,11 @@ static int hva_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) struct vb2_buffer *vb2_buf; vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, buf->type); - - if (buf->index >= vq->num_buffers) { - dev_dbg(dev, "%s buffer index %d out of range (%d)\n", - ctx->name, buf->index, vq->num_buffers); + vb2_buf = vb2_get_buffer(vq, buf->index); + if (!vb2_buf) { + dev_dbg(dev, "%s buffer index %d not found\n", ctx->name, buf->index); return -EINVAL; } - - vb2_buf = vb2_get_buffer(vq, buf->index); stream = to_hva_stream(to_vb2_v4l2_buffer(vb2_buf)); stream->bytesused = buf->bytesused; }