drivers/soc/mediatek/mtk-svs.c:1740 svs_get_efuse_data() warn: passing zero to 'PTR_ERR'
kernel test robot
build botBCC: [email protected]
CC: [email protected]
TO: Roger Lu <[email protected]>
CC: Matthias Brugger <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git v6.3-tmp/soc head: d19b23050ea976b42a6527a623cdd5774c290b8b commit: 6c7174fd90a4690e2154a6a77ad2ffa119166217 [42/48] soc: mediatek: mtk-svs: use svs get efuse common function
:::::: branch date: 34 hours ago
:::::: commit date: 13 days ago
config: microblaze-randconfig-m031-20230212 (https://download.01.org/0day-ci/archive/20230216/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Link: https://lore.kernel.org/r/[email protected]/
New smatch warnings:drivers/soc/mediatek/mtk-svs.c:1740 svs_get_efuse_data() warn: passing zero to 'PTR_ERR'
Old smatch warnings:drivers/soc/mediatek/mtk-svs.c:1742 svs_get_efuse_data() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +1740 drivers/soc/mediatek/mtk-svs.c
681a02e9500073c Roger Lu 2022-05-16 1731
6c7174fd90a4690 Roger Lu 2023-02-02 1732 static int svs_get_efuse_data(struct svs_platform *svsp,
6c7174fd90a4690 Roger Lu 2023-02-02 1733 const char *nvmem_cell_name,
6c7174fd90a4690 Roger Lu 2023-02-02 1734 u32 **svsp_efuse, size_t *svsp_efuse_max)
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1735 {
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1736 struct nvmem_cell *cell;
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1737
6c7174fd90a4690 Roger Lu 2023-02-02 1738 cell = nvmem_cell_get(svsp->dev, nvmem_cell_name);
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1739 if (IS_ERR_OR_NULL(cell)) {
6c7174fd90a4690 Roger Lu 2023-02-02 @1740 dev_err(svsp->dev, "no \"%s\"? %ld\n",
6c7174fd90a4690 Roger Lu 2023-02-02 1741 nvmem_cell_name, PTR_ERR(cell));
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1742 return PTR_ERR(cell);
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1743 }
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1744
6c7174fd90a4690 Roger Lu 2023-02-02 1745 *svsp_efuse = nvmem_cell_read(cell, svsp_efuse_max);
6c7174fd90a4690 Roger Lu 2023-02-02 1746 if (IS_ERR(*svsp_efuse)) {
6c7174fd90a4690 Roger Lu 2023-02-02 1747 dev_err(svsp->dev, "cannot read \"%s\" efuse: %ld\n",
6c7174fd90a4690 Roger Lu 2023-02-02 1748 nvmem_cell_name, PTR_ERR(*svsp_efuse));
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1749 nvmem_cell_put(cell);
6c7174fd90a4690 Roger Lu 2023-02-02 1750 return PTR_ERR(*svsp_efuse);
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1751 }
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1752
6c7174fd90a4690 Roger Lu 2023-02-02 1753 *svsp_efuse_max /= sizeof(u32);
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1754 nvmem_cell_put(cell);
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1755
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1756 return 0;
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1757 }
43819e385330662 AngeloGioacchino Del Regno 2022-08-25 1758 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests