From dd7950746ff05377e21357e9d409e41221669a8e Mon Sep 17 00:00:00 2001 From: Michael Adisumarta Date: Tue, 14 Jul 2020 16:43:36 -0700 Subject: [PATCH] techpack: ipa: Fixing compile errors Addressed unintialized pointers and P1 errors and fixing them accordingly. Change-Id: Iba70c5fdf91fffd823c3473383e687fe8b549b64 Signed-off-by: Michael Adisumarta --- drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c | 4 ++++ drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c | 10 ++++++++++ drivers/platform/msm/ipa/ipa_v3/rmnet_ctl_ipa.c | 7 ++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c b/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c index de98119b34bb..6716a1aa59fb 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c @@ -181,6 +181,10 @@ static int ipa_mhi_read_write_host(enum ipa_mhi_dma_dir dir, void *dev_addr, if (pdev) mem.base = dma_alloc_coherent(pdev, mem.size, &mem.phys_base, GFP_KERNEL); + else { + IPA_MHI_ERR("platform dev is not valid"); + return -EFAULT; + } if (!mem.base) { IPA_MHI_ERR( "dma_alloc_coherent failed, DMA buff size %d\n" diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c b/drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c index ed34f253628c..5f24ebaa66fd 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c @@ -632,12 +632,22 @@ static int ipa_wdi_enable_pipes_internal(void) ipa_ep_idx_tx = ipa_get_ep_mapping(IPA_CLIENT_WLAN2_CONS); } + if (ipa_ep_idx_tx <= 0 || ipa_ep_idx_rx <= 0) + return -EFAULT; + if (ipa_wdi_ctx->wdi_version == IPA_WDI_3) { if (ipa_enable_wdi_pipes(ipa_ep_idx_tx, ipa_ep_idx_rx)) { IPA_WDI_ERR("fail to enable wdi pipes\n"); return -EFAULT; } } else { + if ((ipa_wdi_ctx->tx_pipe_hdl >= IPA3_MAX_NUM_PIPES) || + (ipa_wdi_ctx->tx_pipe_hdl < 0) || + (ipa_wdi_ctx->rx_pipe_hdl >= IPA3_MAX_NUM_PIPES) || + (ipa_wdi_ctx->rx_pipe_hdl < 0)) { + IPA_WDI_ERR("pipe handle not valid\n"); + return -EFAULT; + } if (ipa3_enable_wdi_pipe(ipa_wdi_ctx->tx_pipe_hdl)) { IPA_WDI_ERR("fail to enable wdi tx pipe\n"); return -EFAULT; diff --git a/drivers/platform/msm/ipa/ipa_v3/rmnet_ctl_ipa.c b/drivers/platform/msm/ipa/ipa_v3/rmnet_ctl_ipa.c index c710dbd7deef..88ad5cec8eaf 100644 --- a/drivers/platform/msm/ipa/ipa_v3/rmnet_ctl_ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/rmnet_ctl_ipa.c @@ -497,7 +497,7 @@ static void rmnet_ctl_wakeup_ipa(struct work_struct *work) int ret; unsigned long flags; struct sk_buff *skb; - int len; + int len = 0; /* calling from WQ */ ret = ipa_pm_activate_sync(rmnet_ctl_ipa3_ctx->rmnet_ctl_pm_hdl); @@ -514,8 +514,9 @@ static void rmnet_ctl_wakeup_ipa(struct work_struct *work) /* dequeue the skb */ while (skb_queue_len(&rmnet_ctl_ipa3_ctx->tx_queue) > 0) { skb = skb_dequeue(&rmnet_ctl_ipa3_ctx->tx_queue); - if (skb) - len = skb->len; + if (skb == NULL) + continue; + len = skb->len; spin_unlock_irqrestore(&rmnet_ctl_ipa3_ctx->tx_lock, flags); /* * both data packets and command will be routed to