From patchwork Wed Apr 15 05:45:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3466 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 075EA62E5D for ; Wed, 15 Apr 2020 07:45:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="ZEwvZd6E"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=o4EhX38svgTspXQfxY8ePTp5nTnDJzGWVBuo3ABRYgc=; b=ZEwvZd6EPbQodFvBIH64/Khz0SPtARu2K27wY6J6On4aVmOnWjBMqkxaMSn5FMrvaIeX JdQl1plNbxrh9jXFL1Nialc3Pd0GxfHw05M+hXWBIWoKLXGIIWf3iym3xfdjV1A2tCt9dn oEtxX2mDdESX0Cu7cHKueAtuNMXjvJjds= Received: by filterdrecv-p3iad2-8ddf98858-w5zgs with SMTP id filterdrecv-p3iad2-8ddf98858-w5zgs-17-5E969F71-4F 2020-04-15 05:45:21.563699619 +0000 UTC m=+1744675.858027244 Received: from mail.uajain.com (unknown) by ismtpd0001p1maa1.sendgrid.net (SG) with ESMTP id qPeiZhENSuOU1qsn6zLgPQ Wed, 15 Apr 2020 05:45:21.091 +0000 (UTC) From: Umang Jain Date: Wed, 15 Apr 2020 05:45:21 +0000 (UTC) Message-Id: <20200415054503.13108-3-email@uajain.com> In-Reply-To: <20200415054503.13108-1-email@uajain.com> References: <20200415054503.13108-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPc4om/Oij3lMEQBxKPi/30O44eBMubwDLmMWUm9+h6ldpyijd3CR2QLxlACsPewttWvLCUndqbmwgd0kWOpbpRJqhZq0YkYt0R3f6ZX9w4dU1QU7jU65DtJjMdpoiPN5iYS88cIK2UWByK8cQgSNSUTruGYNinRJbzatRTn4eTU5AwMF3EPIte4/L6J3jcwEyRtyU9uqCuLwa3s85GppAQsA== To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v2 2/2] test: v4l2_videodevice: buffer_cache: Fail the test if no hot-buffer is obtained X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 05:45:23 -0000 Pointed out by Coverity DefectId=279090 Signed-off-by: Umang Jain --- test/v4l2_videodevice/buffer_cache.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp index d730e75..1870249 100644 --- a/test/v4l2_videodevice/buffer_cache.cpp +++ b/test/v4l2_videodevice/buffer_cache.cpp @@ -90,6 +90,11 @@ public: /* Pick a hot buffer at random and store its index. */ int hotBuffer = dist(generator_); int hotIndex = cache->get(*buffers[hotBuffer].get()); + if (hotIndex < 0) { + std::cout << "Failed lookup from cache" << std::endl; + return TestFail; + } + cache->put(hotIndex); /*