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: <98e45455-7d5d-48e1-a87e-e0b3a05f1bb0@kili.mountain>
Date:   Sat, 13 May 2023 13:14:00 +0300
From:   Dan Carpenter <dan.carpenter@...aro.org>
To:     oe-kbuild@...ts.linux.dev, Krzysztof Kozlowski <krzk@...nel.org>
Cc:     lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
        linux-kernel@...r.kernel.org,
        Bjorn Andersson <andersson@...nel.org>,
        Thara Gopinath <thara.gopinath@...il.com>
Subject: drivers/soc/qcom/icc-bwmon.c:360 bwmon_probe() warn: passing zero to
 'dev_err_probe'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9a48d604672220545d209e9996c2a1edbb5637f6
commit: b9c2ae6cac403dee3195fda9eb28d8ee733b225b soc: qcom: icc-bwmon: Add bandwidth monitoring driver
config: openrisc-randconfig-m031-20230509 (https://download.01.org/0day-ci/archive/20230513/202305131657.76XeHDjF-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>
| Link: https://lore.kernel.org/r/202305131657.76XeHDjF-lkp@intel.com/

New smatch warnings:
drivers/soc/qcom/icc-bwmon.c:360 bwmon_probe() warn: passing zero to 'dev_err_probe'

Old smatch warnings:
drivers/soc/qcom/icc-bwmon.c:365 bwmon_probe() warn: passing zero to 'dev_err_probe'

vim +/dev_err_probe +360 drivers/soc/qcom/icc-bwmon.c

b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  327  static int bwmon_probe(struct platform_device *pdev)
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  328  {
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  329  	struct device *dev = &pdev->dev;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  330  	struct dev_pm_opp *opp;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  331  	struct icc_bwmon *bwmon;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  332  	const struct icc_bwmon_data *data;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  333  	int ret;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  334  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  335  	bwmon = devm_kzalloc(dev, sizeof(*bwmon), GFP_KERNEL);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  336  	if (!bwmon)
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  337  		return -ENOMEM;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  338  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  339  	data = of_device_get_match_data(dev);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  340  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  341  	bwmon->base = devm_platform_ioremap_resource(pdev, 0);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  342  	if (IS_ERR(bwmon->base)) {
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  343  		dev_err(dev, "failed to map bwmon registers\n");
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  344  		return PTR_ERR(bwmon->base);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  345  	}
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  346  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  347  	bwmon->irq = platform_get_irq(pdev, 0);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  348  	if (bwmon->irq < 0) {
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  349  		dev_err(dev, "failed to acquire bwmon IRQ\n");
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  350  		return bwmon->irq;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  351  	}
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  352  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  353  	ret = devm_pm_opp_of_add_table(dev);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  354  	if (ret)
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  355  		return dev_err_probe(dev, ret, "failed to add OPP table\n");
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  356  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  357  	bwmon->max_bw_kbps = UINT_MAX;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  358  	opp = dev_pm_opp_find_bw_floor(dev, &bwmon->max_bw_kbps, 0);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  359  	if (IS_ERR(opp))
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04 @360  		return dev_err_probe(dev, ret, "failed to find max peak bandwidth\n");
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  361  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  362  	bwmon->min_bw_kbps = 0;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  363  	opp = dev_pm_opp_find_bw_ceil(dev, &bwmon->min_bw_kbps, 0);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  364  	if (IS_ERR(opp))
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  365  		return dev_err_probe(dev, ret, "failed to find min peak bandwidth\n");

s/ret/PTR_ERR(opp)/

b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  366  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  367  	bwmon->sample_ms = data->sample_ms;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  368  	bwmon->default_lowbw_kbps = data->default_lowbw_kbps;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  369  	bwmon->dev = dev;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  370  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  371  	bwmon_disable(bwmon);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  372  	ret = devm_request_threaded_irq(dev, bwmon->irq, bwmon_intr,
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  373  					bwmon_intr_thread,
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  374  					IRQF_ONESHOT, dev_name(dev), bwmon);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  375  	if (ret)
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  376  		return dev_err_probe(dev, ret, "failed to request IRQ\n");
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  377  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  378  	platform_set_drvdata(pdev, bwmon);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  379  	bwmon_start(bwmon, data);
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  380  
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  381  	return 0;
b9c2ae6cac403de Krzysztof Kozlowski 2022-07-04  382  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ