diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c
index b380a7d40d858f7caa59d839ee3b27da8a26f3ac..7dacf8c1354f7c2b440a3ebefc7aacd3a7d6c798 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -1298,7 +1298,7 @@ static void isc_hist_count(struct isc_device *isc)
 	regmap_bulk_read(regmap, ISC_HIS_ENTRY, hist_entry, HIST_ENTRIES);
 
 	*hist_count = 0;
-	for (i = 0; i <= HIST_ENTRIES; i++)
+	for (i = 0; i < HIST_ENTRIES; i++)
 		*hist_count += i * (*hist_entry++);
 }