lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202204130935.urqkcDrG-lkp@intel.com>
Date:   Wed, 13 Apr 2022 09:07:09 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, "jason-jh.lin" <jason-jh.lin@...iatek.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Chun-Kuang Hu <chunkuang.hu@...nel.org>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org, fshao@...omium.org,
        David Airlie <airlied@...ux.ie>, singo.chang@...iatek.com,
        dri-devel@...ts.freedesktop.org,
        Fabien Parent <fparent@...libre.com>,
        linux-stm32@...md-mailman.stormreply.com, roy-cw.yeh@...iatek.com,
        Project_Global_Chrome_Upstream_Group@...iatek.com,
        Yongqiang Niu <yongqiang.niu@...iatek.com>,
        Rex-BC Chen <rex-bc.chen@...iatek.com>,
        devicetree@...r.kernel.org, nancy.lin@...iatek.com,
        linux-mediatek@...ts.infradead.org, hsinyi@...omium.org,
        linux-arm-kernel@...ts.infradead.org,
        "jason-jh . lin" <jason-jh.lin@...iatek.com>,
        linux-kernel@...r.kernel.org, moudy.ho@...iatek.com,
        Maxime Coquelin <mcoquelin.stm32@...il.com>
Subject: Re: [PATCH v18 03/10] soc: mediatek: add mtk-mmsys support for
 mt8195 vdosys0

Hi "jason-jh.lin",

url:    https://github.com/intel-lab-lkp/linux/commits/jason-jh-lin/Add-Mediatek-Soc-DRM-vdosys0-support-for-mt8195/20220412-183359
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: arc-randconfig-m031-20220411 (https://download.01.org/0day-ci/archive/20220413/202204130935.urqkcDrG-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/soc/mediatek/mtk-mmsys.c:315 mtk_mmsys_probe() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +315 drivers/soc/mediatek/mtk-mmsys.c

13032709e23285 Matthias Brugger       2020-03-25  281  static int mtk_mmsys_probe(struct platform_device *pdev)
13032709e23285 Matthias Brugger       2020-03-25  282  {
2c758e301ed95a Enric Balletbo i Serra 2020-03-25  283  	struct device *dev = &pdev->dev;
13032709e23285 Matthias Brugger       2020-03-25  284  	struct platform_device *clks;
667c769246b01c Enric Balletbo i Serra 2020-03-25  285  	struct platform_device *drm;
8cfc54a36d3e79 jason-jh.lin           2022-04-12  286  	const struct mtk_mmsys_match_data *match_data;
ce15e7faa2fc54 CK Hu                  2021-03-17  287  	struct mtk_mmsys *mmsys;
8cfc54a36d3e79 jason-jh.lin           2022-04-12  288  	struct resource *res;
2c758e301ed95a Enric Balletbo i Serra 2020-03-25  289  	int ret;
2c758e301ed95a Enric Balletbo i Serra 2020-03-25  290  
ce15e7faa2fc54 CK Hu                  2021-03-17  291  	mmsys = devm_kzalloc(dev, sizeof(*mmsys), GFP_KERNEL);
ce15e7faa2fc54 CK Hu                  2021-03-17  292  	if (!mmsys)
ce15e7faa2fc54 CK Hu                  2021-03-17  293  		return -ENOMEM;
ce15e7faa2fc54 CK Hu                  2021-03-17  294  
ce15e7faa2fc54 CK Hu                  2021-03-17  295  	mmsys->regs = devm_platform_ioremap_resource(pdev, 0);
ce15e7faa2fc54 CK Hu                  2021-03-17  296  	if (IS_ERR(mmsys->regs)) {
ce15e7faa2fc54 CK Hu                  2021-03-17  297  		ret = PTR_ERR(mmsys->regs);
cc6576029aedc7 Enric Balletbo i Serra 2020-10-06  298  		dev_err(dev, "Failed to ioremap mmsys registers: %d\n", ret);
2c758e301ed95a Enric Balletbo i Serra 2020-03-25  299  		return ret;
2c758e301ed95a Enric Balletbo i Serra 2020-03-25  300  	}
2c758e301ed95a Enric Balletbo i Serra 2020-03-25  301  
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  302  	spin_lock_init(&mmsys->lock);
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  303  
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  304  	mmsys->rcdev.owner = THIS_MODULE;
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  305  	mmsys->rcdev.nr_resets = 32;
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  306  	mmsys->rcdev.ops = &mtk_mmsys_reset_ops;
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  307  	mmsys->rcdev.of_node = pdev->dev.of_node;
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  308  	ret = devm_reset_controller_register(&pdev->dev, &mmsys->rcdev);
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  309  	if (ret) {
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  310  		dev_err(&pdev->dev, "Couldn't register mmsys reset controller: %d\n", ret);
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  311  		return ret;
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  312  	}
f27ef2856343e2 Enric Balletbo i Serra 2021-09-30  313  
8cfc54a36d3e79 jason-jh.lin           2022-04-12  314  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
8cfc54a36d3e79 jason-jh.lin           2022-04-12 @315  	if (PTR_ERR(res)) {

You probably meant IS_ERR() instead of PTR_ERR().  But actually
platform_get_resource() does not return error pointers, it returns
NULL so the correct check is:

	if (!res) {

8cfc54a36d3e79 jason-jh.lin           2022-04-12  316  		dev_err(dev, "Couldn't get mmsys resource\n");
8cfc54a36d3e79 jason-jh.lin           2022-04-12  317  		return -EINVAL;
8cfc54a36d3e79 jason-jh.lin           2022-04-12  318  	}
8cfc54a36d3e79 jason-jh.lin           2022-04-12  319  	mmsys->io_start = res->start;
8cfc54a36d3e79 jason-jh.lin           2022-04-12  320  
8cfc54a36d3e79 jason-jh.lin           2022-04-12  321  	match_data = of_device_get_match_data(dev);
8cfc54a36d3e79 jason-jh.lin           2022-04-12  322  	if (match_data->num_drv_data > 1) {
8cfc54a36d3e79 jason-jh.lin           2022-04-12  323  		/* This SoC has multiple mmsys channels */
8cfc54a36d3e79 jason-jh.lin           2022-04-12  324  		ret = mtk_mmsys_find_match_drvdata(mmsys, match_data);
8cfc54a36d3e79 jason-jh.lin           2022-04-12  325  		if (ret < 0) {
8cfc54a36d3e79 jason-jh.lin           2022-04-12  326  			dev_err(dev, "Couldn't get match driver data\n");
8cfc54a36d3e79 jason-jh.lin           2022-04-12  327  			return ret;
8cfc54a36d3e79 jason-jh.lin           2022-04-12  328  		}
8cfc54a36d3e79 jason-jh.lin           2022-04-12  329  		mmsys->data = match_data->drv_data[ret];
8cfc54a36d3e79 jason-jh.lin           2022-04-12  330  	} else {
8cfc54a36d3e79 jason-jh.lin           2022-04-12  331  		dev_dbg(dev, "Using single mmsys channel\n");
8cfc54a36d3e79 jason-jh.lin           2022-04-12  332  		mmsys->data = match_data->drv_data[0];
8cfc54a36d3e79 jason-jh.lin           2022-04-12  333  	}
8cfc54a36d3e79 jason-jh.lin           2022-04-12  334  
ce15e7faa2fc54 CK Hu                  2021-03-17  335  	platform_set_drvdata(pdev, mmsys);
13032709e23285 Matthias Brugger       2020-03-25  336  
ce15e7faa2fc54 CK Hu                  2021-03-17  337  	clks = platform_device_register_data(&pdev->dev, mmsys->data->clk_driver,
13032709e23285 Matthias Brugger       2020-03-25  338  					     PLATFORM_DEVID_AUTO, NULL, 0);
13032709e23285 Matthias Brugger       2020-03-25  339  	if (IS_ERR(clks))
13032709e23285 Matthias Brugger       2020-03-25  340  		return PTR_ERR(clks);
13032709e23285 Matthias Brugger       2020-03-25  341  
667c769246b01c Enric Balletbo i Serra 2020-03-25  342  	drm = platform_device_register_data(&pdev->dev, "mediatek-drm",
667c769246b01c Enric Balletbo i Serra 2020-03-25  343  					    PLATFORM_DEVID_AUTO, NULL, 0);
ff34e17cf9bce8 Wei Yongjun            2020-05-06  344  	if (IS_ERR(drm)) {
ff34e17cf9bce8 Wei Yongjun            2020-05-06  345  		platform_device_unregister(clks);
667c769246b01c Enric Balletbo i Serra 2020-03-25  346  		return PTR_ERR(drm);
ff34e17cf9bce8 Wei Yongjun            2020-05-06  347  	}
667c769246b01c Enric Balletbo i Serra 2020-03-25  348  
13032709e23285 Matthias Brugger       2020-03-25  349  	return 0;
13032709e23285 Matthias Brugger       2020-03-25  350  }

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ