[bug report] wcn36xx: Transition driver to SMD client
Dan Carpenter
dan.carpenter at linaro.org
Wed Feb 5 01:11:36 PST 2025
Hello Bjorn Andersson,
Commit f303a9311065 ("wcn36xx: Transition driver to SMD client") from
Jan 11, 2017 (linux-next), leads to the following Smatch static
checker warning:
drivers/net/wireless/ath/wcn36xx/main.c:1616 wcn36xx_probe() warn: 'wcn->smd_channel' is not an error pointer
drivers/bluetooth/btqcomsmd.c:155 btqcomsmd_probe() warn: 'btq->acl_channel' is not an error pointer
drivers/bluetooth/btqcomsmd.c:160 btqcomsmd_probe() warn: 'btq->cmd_channel' is not an error pointer
drivers/net/wireless/ath/wcn36xx/main.c
1557 static int wcn36xx_probe(struct platform_device *pdev)
1558 {
1559 struct ieee80211_hw *hw;
1560 struct wcn36xx *wcn;
1561 void *wcnss;
1562 int ret;
1563 const u8 *addr;
1564 int n_channels;
1565
1566 wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe\n");
1567
1568 wcnss = dev_get_drvdata(pdev->dev.parent);
1569
1570 hw = ieee80211_alloc_hw(sizeof(struct wcn36xx), &wcn36xx_ops);
1571 if (!hw) {
1572 wcn36xx_err("failed to alloc hw\n");
1573 ret = -ENOMEM;
1574 goto out_err;
1575 }
1576 platform_set_drvdata(pdev, hw);
1577 wcn = hw->priv;
1578 wcn->hw = hw;
1579 wcn->dev = &pdev->dev;
1580 wcn->first_boot = true;
1581 mutex_init(&wcn->conf_mutex);
1582 mutex_init(&wcn->hal_mutex);
1583 mutex_init(&wcn->scan_lock);
1584 __skb_queue_head_init(&wcn->amsdu);
1585
1586 wcn->hal_buf = devm_kmalloc(wcn->dev, WCN36XX_HAL_BUF_SIZE, GFP_KERNEL);
1587 if (!wcn->hal_buf) {
1588 ret = -ENOMEM;
1589 goto out_wq;
1590 }
1591
1592 n_channels = wcn_band_2ghz.n_channels + wcn_band_5ghz.n_channels;
1593 wcn->chan_survey = devm_kcalloc(wcn->dev,
1594 n_channels,
1595 sizeof(struct wcn36xx_chan_survey),
1596 GFP_KERNEL);
1597 if (!wcn->chan_survey) {
1598 ret = -ENOMEM;
1599 goto out_wq;
1600 }
1601
1602 ret = dma_set_mask_and_coherent(wcn->dev, DMA_BIT_MASK(32));
1603 if (ret < 0) {
1604 wcn36xx_err("failed to set DMA mask: %d\n", ret);
1605 goto out_wq;
1606 }
1607
1608 wcn->nv_file = WLAN_NV_FILE;
1609 ret = of_property_read_string(wcn->dev->parent->of_node, "firmware-name", &wcn->nv_file);
1610 if (ret < 0 && ret != -EINVAL) {
1611 wcn36xx_err("failed to read \"firmware-name\" property: %d\n", ret);
1612 goto out_wq;
1613 }
1614
1615 wcn->smd_channel = qcom_wcnss_open_channel(wcnss, "WLAN_CTRL", wcn36xx_smd_rsp_process, hw);
--> 1616 if (IS_ERR(wcn->smd_channel)) {
qcom_wcnss_open_channel() only returns error pointers if
CONFIG_QCOM_WCNSS_CTRL is disabled. I guess this is a COMPILE_TEST
thing? Normally it would be the reverse way where functions return
error pointers on error for real errors and NULL for COMPILE_TEST of
if the feature is optional.
1617 wcn36xx_err("failed to open WLAN_CTRL channel\n");
1618 ret = PTR_ERR(wcn->smd_channel);
1619 goto out_wq;
1620 }
1621
1622 addr = of_get_property(pdev->dev.of_node, "local-mac-address", &ret);
1623 if (addr && ret != ETH_ALEN) {
1624 wcn36xx_err("invalid local-mac-address\n");
1625 ret = -EINVAL;
1626 goto out_destroy_ept;
1627 } else if (addr) {
1628 wcn36xx_info("mac address: %pM\n", addr);
1629 SET_IEEE80211_PERM_ADDR(wcn->hw, addr);
1630 }
1631
1632 ret = wcn36xx_platform_get_resources(wcn, pdev);
1633 if (ret)
1634 goto out_destroy_ept;
1635
1636 wcn36xx_init_ieee80211(wcn);
1637 ret = ieee80211_register_hw(wcn->hw);
1638 if (ret)
1639 goto out_unmap;
1640
1641 return 0;
1642
1643 out_unmap:
1644 iounmap(wcn->ccu_base);
1645 iounmap(wcn->dxe_base);
1646 out_destroy_ept:
1647 rpmsg_destroy_ept(wcn->smd_channel);
1648 out_wq:
1649 ieee80211_free_hw(hw);
1650 out_err:
1651 return ret;
1652 }
regards,
dan carpenter
More information about the wcn36xx
mailing list