From: Shahed Shaikh <shahed.sha...@cavium.com>

Test the return value of ecore_ptt_acquire for NULL.

Fixes: d378cefab84e ("net/qede: add support for GENEVE tunneling offload")
Coverity issue: 257049

Signed-off-by: Shahed Shaikh <shahed.sha...@cavium.com>
---
 drivers/net/qede/qede_ethdev.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index cab5059..c3cea6d 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -681,7 +681,16 @@ static void qede_set_ucast_cmn_params(struct 
ecore_filter_ucast *ucast)
 
        for_each_hwfn(edev, i) {
                p_hwfn = &edev->hwfns[i];
-               p_ptt = IS_PF(edev) ? ecore_ptt_acquire(p_hwfn) : NULL;
+               if (IS_PF(edev)) {
+                       p_ptt = ecore_ptt_acquire(p_hwfn);
+                       if (!p_ptt) {
+                               DP_ERR(p_hwfn, "Can't acquire PTT\n");
+                               return -EAGAIN;
+                       }
+               } else {
+                       p_ptt = NULL;
+               }
+
                rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt,
                                tunn_info, ECORE_SPQ_MODE_CB, NULL);
                if (IS_PF(edev))
-- 
1.7.10.3

Reply via email to