From c0e9fbb6e6583df3d4a35657ad8defd08c060784 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Sat, 28 Nov 2015 23:01:19 +0100 Subject: [PATCH] facetimehd: return error if channel list is empty Signed-off-by: Sven Schnelle --- fthd_isp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fthd_isp.c b/fthd_isp.c index 6af25cb..35545c6 100644 --- a/fthd_isp.c +++ b/fthd_isp.c @@ -209,13 +209,14 @@ static int isp_fill_channel_info(struct fthd_private *dev_priv, int offset, int int i; if (!num_channels) - return 0; + return -EINVAL; - dev_priv->num_channels = num_channels; dev_priv->channels = kzalloc(num_channels * sizeof(struct fw_channel *), GFP_KERNEL); if (!dev_priv->channels) goto out; + dev_priv->num_channels = num_channels; + for(i = 0; i < num_channels; i++) { FTHD_S2_MEMCPY_FROMIO(&info, offset + i * 256, sizeof(info));