[PATCH 1/1] media: v4l: Guarantee non-NULL return from v4l2_find_nearest_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Guarantee that v4l2_find_nearest_size() returns a non-NULL value when the
mode array passed to it has non-zero number of entries.

Fixes: 95ce9c28601a ("media: v4l: common: Add a function to obtain best size from a list")
Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
---
 drivers/media/v4l2-core/v4l2-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index d34d210908d9..12e8cbe92d7c 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -159,7 +159,7 @@ __v4l2_find_nearest_size(const void *array, size_t array_size,
 			 size_t height_offset, s32 width, s32 height)
 {
 	u32 error, min_error = U32_MAX;
-	const void *best = NULL;
+	const void *best = array;
 	unsigned int i;
 
 	if (!array)
-- 
2.39.2





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux