summaryrefslogtreecommitdiff
path: root/drivers/net/fm/fm.h
diff options
context:
space:
mode:
authorRotariu Marian-Cristian <marian.rotariu@freescale.com>2014-05-19 07:59:52 (GMT)
committerYork Sun <yorksun@freescale.com>2014-07-22 23:25:53 (GMT)
commit1155d8d853ff8639062651a903ae3062f483dc70 (patch)
tree29f1b9110dba51eabef1d960e7c8378b1670a66f /drivers/net/fm/fm.h
parent605714f66998e02cbe3666139a48d83e85fcdc0f (diff)
downloadu-boot-fsl-qoriq-1155d8d853ff8639062651a903ae3062f483dc70.tar.xz
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/fm.h')
-rw-r--r--drivers/net/fm/fm.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/fm/fm.h b/drivers/net/fm/fm.h
index 43de114..316e06e 100644
--- a/drivers/net/fm/fm.h
+++ b/drivers/net/fm/fm.h
@@ -143,6 +143,7 @@ struct fm_eth {
#define MAX_RXBUF_LOG2 11
#define MAX_RXBUF_LEN (1 << MAX_RXBUF_LOG2)
-#define PORT_IS_ENABLED(port) fm_info[fm_port_to_index(port)].enabled
+#define PORT_IS_ENABLED(port) (fm_port_to_index(port) == -1 ? \
+ 0 : fm_info[fm_port_to_index(port)].enabled)
#endif /* __FM_H__ */