drivers/mailbox/mailbox-mpfs.c:255 mpfs_mbox_syscon_probe() warn: passing zero to 'PTR_ERR'
PATCH 2/18 drivers/mailbox/mailbox-mpfs.c:255 mpfs_mbox_syscon_probe() warn: passing zero to 'PTR_ERR'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git gpio-irq-regmap head: d1b7c5558fb6dded2dee2cfebe358de0d93f022e commit: 6692ff5a8ee2df1c83af1c1d1a0dce7bc947d2a2 [2/18] mailbox: mpfs: support new, syscon based, devicetree configuration config: parisc-randconfig-r072-20241106 (https://download.01.org/0day-ci/archive/20241107/[email protected]/config) compiler: hppa-linux-gcc (GCC) 14.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/mailbox/mailbox-mpfs.c:255 mpfs_mbox_syscon_probe() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +255 drivers/mailbox/mailbox-mpfs.c
6692ff5a8ee2df Conor Dooley 2024-08-07 243 static inline int mpfs_mbox_syscon_probe(struct mpfs_mbox *mbox, struct platform_device *pdev)
83d7b1560810e0 Conor Dooley 2021-06-24 244 {
6692ff5a8ee2df Conor Dooley 2024-08-07 245 mbox->control_scb = syscon_regmap_lookup_by_compatible("microchip,mpfs-control-scb");
6692ff5a8ee2df Conor Dooley 2024-08-07 246 if (IS_ERR(mbox->control_scb))
6692ff5a8ee2df Conor Dooley 2024-08-07 247 return PTR_ERR(mbox->control_scb);
83d7b1560810e0 Conor Dooley 2021-06-24 248
6692ff5a8ee2df Conor Dooley 2024-08-07 249 mbox->sysreg_scb = syscon_regmap_lookup_by_compatible("microchip,mpfs-sysreg-scb");
6692ff5a8ee2df Conor Dooley 2024-08-07 250 if (IS_ERR(mbox->sysreg_scb))
6692ff5a8ee2df Conor Dooley 2024-08-07 251 return PTR_ERR(mbox->sysreg_scb);
83d7b1560810e0 Conor Dooley 2021-06-24 252
6692ff5a8ee2df Conor Dooley 2024-08-07 253 mbox->mbox_base = devm_platform_ioremap_resource(pdev, 0);
6692ff5a8ee2df Conor Dooley 2024-08-07 254 if (IS_ERR(mbox->ctrl_base))6692ff5a8ee2df Conor Dooley 2024-08-07 @255 return PTR_ERR(mbox->mbox_base);
s/mbox->mbox_base/mbox->ctrl_base/
6692ff5a8ee2df Conor Dooley 2024-08-07 256 6692ff5a8ee2df Conor Dooley 2024-08-07 257 return 0; 6692ff5a8ee2df Conor Dooley 2024-08-07 258 }
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 29 lines · Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git gpio-irq-regmap head: d1b7c5558fb6dded2dee2cfebe358de0d93f022e commit: 6692ff5a8ee2df1c83af1c1d1a0dce7bc947d2a2 [2/18] mailbox: mpfs: support new, syscon based, devicetree configuration config: parisc-randconfig-r072-20241106 (https://download.01.org/0day-ci/archive/20241107/[email protected]/config) compiler: hppa-linux-gcc (GCC) 14.2.0If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/mailbox/mailbox-mpfs.c:255mpfs_mbox_syscon_probe()warn: passing zero to 'PTR_ERR'vim +/PTR_ERR +255
drivers/mailbox/mailbox-mpfs.c6692ff5a8ee2df Conor Dooley 2024-08-07 243 static inline int mpfs_mbox_syscon_probe(struct mpfs_mbox *mbox, struct platform_device *pdev) 83d7b1560810e0 Conor Dooley 2021-06-24 244 { 6692ff5a8ee2df Conor Dooley 2024-08-07 245 mbox->control_scb = syscon_regmap_lookup_by_compatible("microchip,mpfs-control-scb"); 6692ff5a8ee2df Conor Dooley 2024-08-07 246 if (IS_ERR(mbox->control_scb)) 6692ff5a8ee2df Conor Dooley 2024-08-07 247 return PTR_ERR(mbox->control_scb); 83d7b1560810e0 Conor Dooley 2021-06-24 248 6692ff5a8ee2df Conor Dooley 2024-08-07 249 mbox->sysreg_scb = syscon_regmap_lookup_by_compatible("microchip,mpfs-sysreg-scb"); 6692ff5a8ee2df Conor Dooley 2024-08-07 250 if (IS_ERR(mbox->sysreg_scb)) 6692ff5a8ee2df Conor Dooley 2024-08-07 251 return PTR_ERR(mbox->sysreg_scb); 83d7b1560810e0 Conor Dooley 2021-06-24 252 6692ff5a8ee2df Conor Dooley 2024-08-07 253 mbox->mbox_base = devm_platform_ioremap_resource(pdev, 0); 6692ff5a8ee2df Conor Dooley 2024-08-07 254 if (IS_ERR(mbox->ctrl_base))
Quoted 3 lines
6692ff5a8ee2dfConor Dooley 2024-08-07 @255 returnPTR_ERR(mbox->mbox_base);s/mbox->mbox_base/mbox->ctrl_base/
Sweet, good spot chief. I'll squash this in before I send a v2.
Quoted 9 lines
6692ff5a8ee2df Conor Dooley 2024-08-07 256 6692ff5a8ee2df Conor Dooley 2024-08-07 257 return 0; 6692ff5a8ee2df Conor Dooley 2024-08-07 258 }Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 32 lines · Conor Dooley
Quoted 31 lines · Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git gpio-irq-regmap head: d1b7c5558fb6dded2dee2cfebe358de0d93f022e commit: 6692ff5a8ee2df1c83af1c1d1a0dce7bc947d2a2 [2/18] mailbox: mpfs: support new, syscon based, devicetree configuration config: parisc-randconfig-r072-20241106 (https://download.01.org/0day-ci/archive/20241107/[email protected]/config) compiler: hppa-linux-gcc (GCC) 14.2.0If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/mailbox/mailbox-mpfs.c:255mpfs_mbox_syscon_probe()warn: passing zero to 'PTR_ERR'vim +/PTR_ERR +255
drivers/mailbox/mailbox-mpfs.c6692ff5a8ee2df Conor Dooley 2024-08-07 243 static inline int mpfs_mbox_syscon_probe(struct mpfs_mbox *mbox, struct platform_device *pdev) 83d7b1560810e0 Conor Dooley 2021-06-24 244 { 6692ff5a8ee2df Conor Dooley 2024-08-07 245 mbox->control_scb = syscon_regmap_lookup_by_compatible("microchip,mpfs-control-scb"); 6692ff5a8ee2df Conor Dooley 2024-08-07 246 if (IS_ERR(mbox->control_scb)) 6692ff5a8ee2df Conor Dooley 2024-08-07 247 return PTR_ERR(mbox->control_scb); 83d7b1560810e0 Conor Dooley 2021-06-24 248 6692ff5a8ee2df Conor Dooley 2024-08-07 249 mbox->sysreg_scb = syscon_regmap_lookup_by_compatible("microchip,mpfs-sysreg-scb"); 6692ff5a8ee2df Conor Dooley 2024-08-07 250 if (IS_ERR(mbox->sysreg_scb)) 6692ff5a8ee2df Conor Dooley 2024-08-07 251 return PTR_ERR(mbox->sysreg_scb); 83d7b1560810e0 Conor Dooley 2021-06-24 252 6692ff5a8ee2df Conor Dooley 2024-08-07 253 mbox->mbox_base = devm_platform_ioremap_resource(pdev, 0); 6692ff5a8ee2df Conor Dooley 2024-08-07 254 if (IS_ERR(mbox->ctrl_base))
6692ff5a8ee2dfConor Dooley 2024-08-07 @255 returnPTR_ERR(mbox->mbox_base);
Quoted 3 lines
Quoted 1 line
s/mbox->mbox_base/mbox->ctrl_base/
Sweet, good spot chief. I'll squash this in before I send a v2.
Hmm, actually it should be the other way around and on line 254, no? The code on line 253 is acting on mbox_base and the IS_ERR() is not.
Quoted 33 lines · Conor Dooley
Quoted 32 lines · Conor Dooley
Quoted 31 lines · Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git gpio-irq-regmap head: d1b7c5558fb6dded2dee2cfebe358de0d93f022e commit: 6692ff5a8ee2df1c83af1c1d1a0dce7bc947d2a2 [2/18] mailbox: mpfs: support new, syscon based, devicetree configuration config: parisc-randconfig-r072-20241106 (https://download.01.org/0day-ci/archive/20241107/[email protected]/config) compiler: hppa-linux-gcc (GCC) 14.2.0If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/mailbox/mailbox-mpfs.c:255mpfs_mbox_syscon_probe()warn: passing zero to 'PTR_ERR'vim +/PTR_ERR +255
drivers/mailbox/mailbox-mpfs.c6692ff5a8ee2df Conor Dooley 2024-08-07 243 static inline int mpfs_mbox_syscon_probe(struct mpfs_mbox *mbox, struct platform_device *pdev) 83d7b1560810e0 Conor Dooley 2021-06-24 244 { 6692ff5a8ee2df Conor Dooley 2024-08-07 245 mbox->control_scb = syscon_regmap_lookup_by_compatible("microchip,mpfs-control-scb"); 6692ff5a8ee2df Conor Dooley 2024-08-07 246 if (IS_ERR(mbox->control_scb)) 6692ff5a8ee2df Conor Dooley 2024-08-07 247 return PTR_ERR(mbox->control_scb); 83d7b1560810e0 Conor Dooley 2021-06-24 248 6692ff5a8ee2df Conor Dooley 2024-08-07 249 mbox->sysreg_scb = syscon_regmap_lookup_by_compatible("microchip,mpfs-sysreg-scb"); 6692ff5a8ee2df Conor Dooley 2024-08-07 250 if (IS_ERR(mbox->sysreg_scb)) 6692ff5a8ee2df Conor Dooley 2024-08-07 251 return PTR_ERR(mbox->sysreg_scb); 83d7b1560810e0 Conor Dooley 2021-06-24 252 6692ff5a8ee2df Conor Dooley 2024-08-07 253 mbox->mbox_base = devm_platform_ioremap_resource(pdev, 0); 6692ff5a8ee2df Conor Dooley 2024-08-07 254 if (IS_ERR(mbox->ctrl_base))
6692ff5a8ee2dfConor Dooley 2024-08-07 @255 returnPTR_ERR(mbox->mbox_base);
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
s/mbox->mbox_base/mbox->ctrl_base/
Sweet, good spot chief. I'll squash this in before I send a v2.
Hmm, actually it should be the other way around and on line 254, no? The code on line 253 is acting on
mbox_baseand theIS_ERR()is not.
Indeed. This is a weird warning because it says ->mbox_base can be zero when it can't. It doesn't have the cross function database because this is the zero day bot.
regards,
dan carpenter