Re: [PATCH 3/3] power: avs: qcom-cpr: add support to msm8939

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jun,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on robh/for-next linus/master v5.9-rc7 next-20200930]
[cannot apply to battery/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jun-Nie/Support-CPR-on-msm8939/20200930-142825
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-m031-20200930 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

smatch warnings:
drivers/power/avs/qcom-cpr.c:1957 cpr_fuse_match_tuple() warn: always true condition '(drv->cpr_fuse_map_match != (-1)) => (0-u16max != (-1))'

vim +1957 drivers/power/avs/qcom-cpr.c

  1879	
  1880	/* Match with map table to find out entry index that to retrieve adjustment
  1881	 * array from properties lookup table.
  1882	 */
  1883	#define FUSE_MATCH_TUPLE_SIZE 3
  1884	static int cpr_fuse_match_tuple(struct device *dev, struct cpr_drv *drv)
  1885	{
  1886		u32 cpr_rev, cpr_rev_high;
  1887		u32 pvs_ver, pvs_ver_high;
  1888		struct property *pp;
  1889		int i, tuple_size = FUSE_MATCH_TUPLE_SIZE;
  1890		int ret, len;
  1891		u32 *tmp, speedbin;
  1892	
  1893		drv->cpr_fuse_map_match = FUSE_MATCH_ANY;
  1894		ret = cpr_read_efuse(dev, "cpr_fuse_revision", &cpr_rev);
  1895		if (ret)
  1896			return ret;
  1897	
  1898		ret = cpr_read_efuse(dev, "cpr_fuse_revision_high", &cpr_rev_high);
  1899		if (!ret)
  1900			cpr_rev |= cpr_rev_high << 1;
  1901	
  1902		dev_info(dev, "fuse revision %d\n", cpr_rev);
  1903	
  1904		pp = of_find_property(dev->of_node, "fuse-version-map", &len);
  1905		if (!pp)
  1906			return 0;
  1907	
  1908		ret = cpr_read_efuse(dev, "cpr_pvs_version", &pvs_ver);
  1909		if (ret)
  1910			return ret;
  1911	
  1912		ret = cpr_read_efuse(dev, "cpr_pvs_version_high", &pvs_ver_high);
  1913		if (!ret)
  1914			pvs_ver |= pvs_ver_high << 1;
  1915	
  1916		ret = cpr_read_efuse(dev, "cpr_speedbin", &speedbin);
  1917	
  1918		dev_info(dev, "pvs_version %d, speed_bin %d\n", pvs_ver, speedbin);
  1919	
  1920		drv->cpr_fuse_map_count = len / (sizeof(u32) * tuple_size);
  1921	
  1922		if (len == 0 || len % (sizeof(u32) * tuple_size)) {
  1923			dev_err(dev, "fuse-version-map length=%d is invalid\n",
  1924				len);
  1925			return -EINVAL;
  1926		}
  1927	
  1928		tmp = kzalloc(len, GFP_KERNEL);
  1929		if (!tmp)
  1930			return -ENOMEM;
  1931	
  1932		ret = of_property_read_u32_array(dev->of_node, "fuse-version-map",
  1933					tmp, drv->cpr_fuse_map_count * tuple_size);
  1934		if (ret) {
  1935			dev_err(dev, "could not read fuse-version-map, rc=%d\n",
  1936				ret);
  1937			return ret;
  1938		}
  1939	
  1940		/*
  1941		 * fuse-version-map tuple format:
  1942		 * <speed_bin, pvs_version, cpr_fuse_revision
  1943		 */
  1944		for (i = 0; i < drv->cpr_fuse_map_count; i++) {
  1945			if (tmp[i * tuple_size] != speedbin
  1946			    && tmp[i * tuple_size] != FUSE_MATCH_ANY)
  1947				continue;
  1948			if (tmp[i * tuple_size + 1] != pvs_ver
  1949			    && tmp[i * tuple_size + 1] != FUSE_MATCH_ANY)
  1950				continue;
  1951			if (tmp[i * tuple_size + 2] != cpr_rev
  1952			    && tmp[i * tuple_size + 2] != FUSE_MATCH_ANY)
  1953				continue;
  1954			drv->cpr_fuse_map_match = i;
  1955			break;
  1956		}
> 1957		if (drv->cpr_fuse_map_match != FUSE_MATCH_ANY) {
  1958			dev_info(dev, "fuse map tuple match found: %d\n",
  1959				drv->cpr_fuse_map_match);
  1960		} else {
  1961			dev_warn(dev, "fuse map tuple match not found\n");
  1962			drv->cpr_fuse_map_match = 0;
  1963			drv->cpr_fuse_map_count = 1;
  1964		}
  1965		return 0;
  1966	}
  1967	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux