Re: [PATCH 1/5] drivers: mmc: sdhci-cadence: SD6 controller support

From: Dan Carpenter
Date: Fri Dec 23 2022 - 06:08:12 EST


Hi Piyush,

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Piyush-Malgujar/drivers-mmc-sdhci-cadence-SD6-controller-support/20221219-222703
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20221219142418.27949-2-pmalgujar%40marvell.com
patch subject: [PATCH 1/5] drivers: mmc: sdhci-cadence: SD6 controller support
config: m68k-randconfig-m041-20221218
compiler: m68k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>

smatch warnings:
drivers/mmc/host/sdhci-cadence.c:1663 sdhci_cdns_probe() warn: passing zero to 'PTR_ERR'
drivers/mmc/host/sdhci-cadence.c:1664 sdhci_cdns_probe() warn: ignoring unreachable code.

vim +/PTR_ERR +1663 drivers/mmc/host/sdhci-cadence.c

d12990f9900f49 Piotr Sroka 2017-03-06 1642
ff6af28faff53a Masahiro Yamada 2016-12-08 1643 static int sdhci_cdns_probe(struct platform_device *pdev)
ff6af28faff53a Masahiro Yamada 2016-12-08 1644 {
ff6af28faff53a Masahiro Yamada 2016-12-08 1645 struct sdhci_host *host;
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1646 const struct sdhci_cdns_of_data *data;
ff6af28faff53a Masahiro Yamada 2016-12-08 1647 struct sdhci_pltfm_host *pltfm_host;
ff6af28faff53a Masahiro Yamada 2016-12-08 1648 struct sdhci_cdns_priv *priv;
ff6af28faff53a Masahiro Yamada 2016-12-08 1649 struct clk *clk;
ff6af28faff53a Masahiro Yamada 2016-12-08 1650 int ret;
a89c472d8b55c5 Piotr Sroka 2017-03-21 1651 struct device *dev = &pdev->dev;
ff6af28faff53a Masahiro Yamada 2016-12-08 1652
edf98579065950 Piotr Sroka 2017-03-21 1653 clk = devm_clk_get(dev, NULL);
ff6af28faff53a Masahiro Yamada 2016-12-08 1654 if (IS_ERR(clk))
ff6af28faff53a Masahiro Yamada 2016-12-08 1655 return PTR_ERR(clk);
ff6af28faff53a Masahiro Yamada 2016-12-08 1656
ff6af28faff53a Masahiro Yamada 2016-12-08 1657 ret = clk_prepare_enable(clk);
ff6af28faff53a Masahiro Yamada 2016-12-08 1658 if (ret)
ff6af28faff53a Masahiro Yamada 2016-12-08 1659 return ret;
ff6af28faff53a Masahiro Yamada 2016-12-08 1660
18b587b45c13bb Masahiro Yamada 2020-03-12 1661 data = of_device_get_match_data(dev);
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1662 if (!data) {
8bcfc23a884699 Dhananjay Kangude 2022-12-19 @1663 return PTR_ERR(clk);

ret = -EINVAL?

8bcfc23a884699 Dhananjay Kangude 2022-12-19 @1664 goto disable_clk;

Dead code.

8bcfc23a884699 Dhananjay Kangude 2022-12-19 1665 }
18b587b45c13bb Masahiro Yamada 2020-03-12 1666
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1667 host = sdhci_pltfm_init(pdev, data->pltfm_data, sizeof(*priv));
ff6af28faff53a Masahiro Yamada 2016-12-08 1668 if (IS_ERR(host)) {
ff6af28faff53a Masahiro Yamada 2016-12-08 1669 ret = PTR_ERR(host);
ff6af28faff53a Masahiro Yamada 2016-12-08 1670 goto disable_clk;
ff6af28faff53a Masahiro Yamada 2016-12-08 1671 }
ff6af28faff53a Masahiro Yamada 2016-12-08 1672
ff6af28faff53a Masahiro Yamada 2016-12-08 1673 pltfm_host = sdhci_priv(host);
ff6af28faff53a Masahiro Yamada 2016-12-08 1674 pltfm_host->clk = clk;
ff6af28faff53a Masahiro Yamada 2016-12-08 1675
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1676 host->clk_mul = 0;
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1677 host->max_clk = SDMCLK_MAX_FREQ;
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1678 host->quirks |= SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1679 host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN;
a232a8f2d10750 Masahiro Yamada 2017-08-23 1680 priv = sdhci_pltfm_priv(pltfm_host);
ff6af28faff53a Masahiro Yamada 2016-12-08 1681 priv->hrs_addr = host->ioaddr;
d12990f9900f49 Piotr Sroka 2017-03-06 1682 priv->enhanced_strobe = false;
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1683 priv->cdns_data = data->cdns_data;
ff6af28faff53a Masahiro Yamada 2016-12-08 1684 host->ioaddr += SDHCI_CDNS_SRS_BASE;
d12990f9900f49 Piotr Sroka 2017-03-06 1685 host->mmc_host_ops.hs400_enhanced_strobe =
d12990f9900f49 Piotr Sroka 2017-03-06 1686 sdhci_cdns_hs400_enhanced_strobe;
ff6af28faff53a Masahiro Yamada 2016-12-08 1687
861183f115cd80 Piotr Sroka 2017-04-11 1688 sdhci_get_of_property(pdev);
861183f115cd80 Piotr Sroka 2017-04-11 1689
ff6af28faff53a Masahiro Yamada 2016-12-08 1690 ret = mmc_of_parse(host->mmc);
ff6af28faff53a Masahiro Yamada 2016-12-08 1691 if (ret)
ff6af28faff53a Masahiro Yamada 2016-12-08 1692 goto free;
ff6af28faff53a Masahiro Yamada 2016-12-08 1693
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1694 ret = data->phy_probe(pdev, priv);
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1695 if (ret)
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1696 goto free;
a232a8f2d10750 Masahiro Yamada 2017-08-23 1697
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1698 ret = priv->cdns_data->phy_init(priv);
a89c472d8b55c5 Piotr Sroka 2017-03-21 1699 if (ret)
a89c472d8b55c5 Piotr Sroka 2017-03-21 1700 goto free;
ff6af28faff53a Masahiro Yamada 2016-12-08 1701
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1702 sdhci_enable_v4_mode(host);
8bcfc23a884699 Dhananjay Kangude 2022-12-19 1703 __sdhci_read_caps(host, NULL, NULL, NULL);
ff6af28faff53a Masahiro Yamada 2016-12-08 1704 ret = sdhci_add_host(host);
ff6af28faff53a Masahiro Yamada 2016-12-08 1705 if (ret)
ff6af28faff53a Masahiro Yamada 2016-12-08 1706 goto free;
ff6af28faff53a Masahiro Yamada 2016-12-08 1707
ff6af28faff53a Masahiro Yamada 2016-12-08 1708 return 0;
ff6af28faff53a Masahiro Yamada 2016-12-08 1709 free:
ff6af28faff53a Masahiro Yamada 2016-12-08 1710 sdhci_pltfm_free(pdev);
ff6af28faff53a Masahiro Yamada 2016-12-08 1711 disable_clk:
ff6af28faff53a Masahiro Yamada 2016-12-08 1712 clk_disable_unprepare(clk);
ff6af28faff53a Masahiro Yamada 2016-12-08 1713
ff6af28faff53a Masahiro Yamada 2016-12-08 1714 return ret;
ff6af28faff53a Masahiro Yamada 2016-12-08 1715 }

--
0-DAY CI Kernel Test Service
https://01.org/lkp