]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: wwan: t7xx: Fix smatch errors
authorRicardo Martinez <ricardo.martinez@linux.intel.com>
Wed, 18 May 2022 19:55:29 +0000 (12:55 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 May 2022 01:37:09 +0000 (18:37 -0700)
t7xx_request_irq() error: uninitialized symbol 'ret'.

t7xx_core_hk_handler() error: potentially dereferencing uninitialized 'event'.
If the condition to enter the loop that waits for the handshake event
is false on the first iteration then the uninitialized 'event' will be
dereferenced, fix this by initializing 'event' to NULL.

t7xx_port_proxy_recv_skb() warn: variable dereferenced before check 'skb'.
No need to check skb at t7xx_port_proxy_recv_skb() since we know it
is always called with a valid skb by t7xx_cldma_gpd_rx_from_q().

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ricardo Martinez <ricardo.martinez@linux.intel.com>
Link: https://lore.kernel.org/r/20220518195529.126246-1-ricardo.martinez@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/wwan/t7xx/t7xx_modem_ops.c
drivers/net/wwan/t7xx/t7xx_pci.c
drivers/net/wwan/t7xx/t7xx_port_proxy.c

index 1056ad9bf34fd04ec58563ee349c9efcb21807e8..3458af31e8647050e2308a7b34a36a66a8e03419 100644 (file)
@@ -458,9 +458,9 @@ static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl
                                 enum t7xx_fsm_event_state event_id,
                                 enum t7xx_fsm_event_state err_detect)
 {
+       struct t7xx_fsm_event *event = NULL, *event_next;
        struct t7xx_sys_info *core_info = &md->core_md;
        struct device *dev = &md->t7xx_dev->pdev->dev;
-       struct t7xx_fsm_event *event, *event_next;
        unsigned long flags;
        int ret;
 
@@ -493,7 +493,7 @@ static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl
                        goto err_free_event;
        }
 
-       if (ctl->exp_flg)
+       if (!event || ctl->exp_flg)
                goto err_free_event;
 
        ret = t7xx_parse_host_rt_data(ctl, core_info, dev, event->data, event->length);
index 5f1bb8d6afb60c49b5d7c372cb448fa872d2c9db..871f2a27a398a34568980ab0d3b142e2e5cb6876 100644 (file)
@@ -568,7 +568,7 @@ static const struct dev_pm_ops t7xx_pci_pm_ops = {
 static int t7xx_request_irq(struct pci_dev *pdev)
 {
        struct t7xx_pci_dev *t7xx_dev;
-       int ret, i;
+       int ret = 0, i;
 
        t7xx_dev = pci_get_drvdata(pdev);
 
index 7d2c0e81e33d9a3430750791528d9aeac3cac7e4..d4de047ff0d49d782b3d5d74274d017fc478f531 100644 (file)
@@ -350,9 +350,6 @@ static int t7xx_port_proxy_recv_skb(struct cldma_queue *queue, struct sk_buff *s
        u16 seq_num, channel;
        int ret;
 
-       if (!skb)
-               return -EINVAL;
-
        channel = FIELD_GET(CCCI_H_CHN_FLD, le32_to_cpu(ccci_h->status));
        if (t7xx_fsm_get_md_state(ctl) == MD_STATE_INVALID) {
                dev_err_ratelimited(dev, "Packet drop on channel 0x%x, modem not ready\n", channel);