summaryrefslogtreecommitdiffstats
path: root/drivers/net/fm/init.c
diff options
context:
space:
mode:
authorRotariu Marian-Cristian <marian.rotariu@freescale.com>2014-05-19 10:59:52 +0300
committerYork Sun <yorksun@freescale.com>2014-07-22 16:25:53 -0700
commit1155d8d853ff8639062651a903ae3062f483dc70 (patch)
tree29f1b9110dba51eabef1d960e7c8378b1670a66f /drivers/net/fm/init.c
parent605714f66998e02cbe3666139a48d83e85fcdc0f (diff)
downloadtalos-obmc-uboot-1155d8d853ff8639062651a903ae3062f483dc70.tar.gz
talos-obmc-uboot-1155d8d853ff8639062651a903ae3062f483dc70.zip
net/fm: call fm_port_to_index() with proper checks
Some of the fm_port_to_index() callers did not check for -1 return value and used -1 as an array index. Signed-off-by: Marian Rotariu <marian.rotariu@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
Diffstat (limited to 'drivers/net/fm/init.c')
-rw-r--r--drivers/net/fm/init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c
index cd787f4eed..ff04695c32 100644
--- a/drivers/net/fm/init.c
+++ b/drivers/net/fm/init.c
@@ -147,6 +147,9 @@ void fm_disable_port(enum fm_port port)
{
int i = fm_port_to_index(port);
+ if (i == -1)
+ return;
+
fm_info[i].enabled = 0;
fman_disable_port(port);
}
@@ -155,6 +158,9 @@ void fm_enable_port(enum fm_port port)
{
int i = fm_port_to_index(port);
+ if (i == -1)
+ return;
+
fm_info[i].enabled = 1;
fman_enable_port(port);
}
OpenPOWER on IntegriCloud