Re: [PATCH v2 13/14] irqchip/s3c24xx: Fix potential resource leaks

From: kernel test robot
Date: Wed Jun 24 2020 - 18:55:47 EST


Hi Tiezhu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.8-rc2 next-20200624]
[cannot apply to tip/irq/core omap/for-next xlnx/master arm-jcooper/irqchip/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Tiezhu-Yang/irqchip-Fix-potential-resource-leaks/20200624-144653
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3e08a95294a4fb3702bb3d35ed08028433c37fe6
config: arm-randconfig-r012-20200624 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

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

All error/warnings (new ones prefixed by >>):

drivers/irqchip/irq-s3c24xx.c:359:39: warning: no previous prototype for 's3c24xx_handle_irq' [-Wmissing-prototypes]
359 | asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-s3c24xx.c:776:13: warning: no previous prototype for 's3c2412_init_irq' [-Wmissing-prototypes]
776 | void __init s3c2412_init_irq(void)
| ^~~~~~~~~~~~~~~~
drivers/irqchip/irq-s3c24xx.c:875:13: warning: no previous prototype for 's3c2416_init_irq' [-Wmissing-prototypes]
875 | void __init s3c2416_init_irq(void)
| ^~~~~~~~~~~~~~~~
drivers/irqchip/irq-s3c24xx.c:954:13: warning: no previous prototype for 's3c2440_init_irq' [-Wmissing-prototypes]
954 | void __init s3c2440_init_irq(void)
| ^~~~~~~~~~~~~~~~
drivers/irqchip/irq-s3c24xx.c: In function 's3c_init_intc_of':
>> drivers/irqchip/irq-s3c24xx.c:1242:3: error: 'ret' undeclared (first use in this function)
1242 | ret = -EINVAL;
| ^~~
drivers/irqchip/irq-s3c24xx.c:1242:3: note: each undeclared identifier is reported only once for each function it appears in
drivers/irqchip/irq-s3c24xx.c: At top level:
drivers/irqchip/irq-s3c24xx.c:1311:12: warning: no previous prototype for 's3c2410_init_intc_of' [-Wmissing-prototypes]
1311 | int __init s3c2410_init_intc_of(struct device_node *np,
| ^~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-s3c24xx.c:1333:12: warning: no previous prototype for 's3c2416_init_intc_of' [-Wmissing-prototypes]
1333 | int __init s3c2416_init_intc_of(struct device_node *np,
| ^~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-s3c24xx.c: In function 's3c_init_intc_of':
>> drivers/irqchip/irq-s3c24xx.c:1298:1: warning: control reaches end of non-void function [-Wreturn-type]
1298 | }
| ^

vim +/ret +1242 drivers/irqchip/irq-s3c24xx.c

1221
1222 static int __init s3c_init_intc_of(struct device_node *np,
1223 struct device_node *interrupt_parent,
1224 struct s3c24xx_irq_of_ctrl *s3c_ctrl, int num_ctrl)
1225 {
1226 struct s3c_irq_intc *intc;
1227 struct s3c24xx_irq_of_ctrl *ctrl;
1228 struct irq_domain *domain;
1229 void __iomem *reg_base;
1230 int i;
1231
1232 reg_base = of_iomap(np, 0);
1233 if (!reg_base) {
1234 pr_err("irq-s3c24xx: could not map irq registers\n");
1235 return -EINVAL;
1236 }
1237
1238 domain = irq_domain_add_linear(np, num_ctrl * 32,
1239 &s3c24xx_irq_ops_of, NULL);
1240 if (!domain) {
1241 pr_err("irq: could not create irq-domain\n");
> 1242 ret = -EINVAL;
1243 goto out_iounmap;
1244 }
1245
1246 for (i = 0; i < num_ctrl; i++) {
1247 ctrl = &s3c_ctrl[i];
1248
1249 pr_debug("irq: found controller %s\n", ctrl->name);
1250
1251 intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
1252 if (!intc) {
1253 ret = -ENOMEM;
1254 goto out_domain_remove;
1255 }
1256
1257 intc->domain = domain;
1258 intc->irqs = kcalloc(32, sizeof(struct s3c_irq_data),
1259 GFP_KERNEL);
1260 if (!intc->irqs) {
1261 ret = -ENOMEM;
1262 goto out_free;
1263 }
1264
1265 if (ctrl->parent) {
1266 intc->reg_pending = reg_base + ctrl->offset;
1267 intc->reg_mask = reg_base + ctrl->offset + 0x4;
1268
1269 if (*(ctrl->parent)) {
1270 intc->parent = *(ctrl->parent);
1271 } else {
1272 pr_warn("irq: parent of %s missing\n",
1273 ctrl->name);
1274 kfree(intc->irqs);
1275 kfree(intc);
1276 continue;
1277 }
1278 } else {
1279 intc->reg_pending = reg_base + ctrl->offset;
1280 intc->reg_mask = reg_base + ctrl->offset + 0x08;
1281 intc->reg_intpnd = reg_base + ctrl->offset + 0x10;
1282 }
1283
1284 s3c24xx_clear_intc(intc);
1285 s3c_intc[i] = intc;
1286 }
1287
1288 set_handle_irq(s3c24xx_handle_irq);
1289
1290 return 0;
1291
1292 out_free:
1293 kfree(intc);
1294 out_domain_remove:
1295 irq_domain_remove(domain);
1296 out_iounmap:
1297 iounmap(reg_base);
> 1298 }
1299

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

Attachment: .config.gz
Description: application/gzip