summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/serial_core.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-03-09 10:09:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-17 15:00:40 +0100
commiteff37b5ea3d92c9d33a7e543460a565d17909ae4 (patch)
tree45e16e83576f26af5fa3407d796b8089c13d4dd6 /drivers/tty/serial/serial_core.c
parent5406dc04884b96b8438b664d1a9b73e30e2a5517 (diff)
downloadlinux-stable-eff37b5ea3d92c9d33a7e543460a565d17909ae4.tar.gz
linux-stable-eff37b5ea3d92c9d33a7e543460a565d17909ae4.tar.bz2
linux-stable-eff37b5ea3d92c9d33a7e543460a565d17909ae4.zip
serial: Use ARRAY_SIZE() with iso7816 reserved array
Instead of a literal, size the for loop iteration based on the actual array using ARRAY_SIZE(). Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230309080923.11778-2-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/serial_core.c')
-rw-r--r--drivers/tty/serial/serial_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 2bd32c8ece39..ee2aabcc8943 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -15,6 +15,7 @@
#include <linux/init.h>
#include <linux/console.h>
#include <linux/gpio/consumer.h>
+#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
@@ -1491,7 +1492,7 @@ static int uart_set_iso7816_config(struct uart_port *port,
* There are 5 words reserved for future use. Check that userspace
* doesn't put stuff in there to prevent breakages in the future.
*/
- for (i = 0; i < 5; i++)
+ for (i = 0; i < ARRAY_SIZE(iso7816.reserved); i++)
if (iso7816.reserved[i])
return -EINVAL;