Re: [PATCH] drivers: irqchip: add irq-type-changer

From: kernel test robot
Date: Mon Jan 24 2022 - 04:48:38 EST


Hi Nikita,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/irq/core]
[also build test WARNING on v5.17-rc1 next-20220124]
[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/Nikita-Yushchenko/drivers-irqchip-add-irq-type-changer/20220120-041926
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 67d50b5f9114ae55d45e08e1fd1d6ae152622bf3
config: microblaze-randconfig-s032-20220124 (https://download.01.org/0day-ci/archive/20220124/202201241716.mt2XBMZQ-lkp@xxxxxxxxx/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/08692091f6fa9d1ee51baef78ce2adf983b2248a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nikita-Yushchenko/drivers-irqchip-add-irq-type-changer/20220120-041926
git checkout 08692091f6fa9d1ee51baef78ce2adf983b2248a
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/irqchip/

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


sparse warnings: (new ones prefixed by >>)
>> drivers/irqchip/irq-type-changer.c:111:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] size @@ got restricted gfp_t @@
drivers/irqchip/irq-type-changer.c:111:22: sparse: expected unsigned int [usertype] size
drivers/irqchip/irq-type-changer.c:111:22: sparse: got restricted gfp_t
>> drivers/irqchip/irq-type-changer.c:111:46: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted gfp_t [usertype] flags @@ got unsigned int @@
drivers/irqchip/irq-type-changer.c:111:46: sparse: expected restricted gfp_t [usertype] flags
drivers/irqchip/irq-type-changer.c:111:46: sparse: got unsigned int

vim +111 drivers/irqchip/irq-type-changer.c

81
82 static int __init changer_of_init(struct device_node *node,
83 struct device_node *parent)
84 {
85 struct irq_domain *domain, *parent_domain;
86 int count, i, ret;
87 struct changer *ch;
88 struct of_phandle_args pargs;
89 irq_hw_number_t unused;
90
91 if (!parent) {
92 pr_err("%pOF: no parent node\n", node);
93 return -EINVAL;
94 }
95
96 parent_domain = irq_find_host(parent);
97 if (!parent_domain) {
98 pr_err("%pOF: no parent domain\n", node);
99 return -EINVAL;
100 }
101
102 if (WARN_ON(!parent_domain->ops->translate))
103 return -EINVAL;
104
105 count = of_irq_count(node);
106 if (count < 1) {
107 pr_err("%pOF: no interrupts defined\n", node);
108 return -EINVAL;
109 }
110
> 111 ch = kzalloc(GFP_KERNEL, sizeof(*ch) + count * sizeof(ch->out[0]));
112 if (!ch)
113 return -ENOMEM;
114 ch->count = count;
115
116 for (i = 0; i < count; i++) {
117 ret = of_irq_parse_one(node, i, &pargs);
118 if (ret) {
119 pr_err("%pOF: interrupt %d: error %d parsing\n",
120 node, i, ret);
121 goto out_free;
122 }
123 of_phandle_args_to_fwspec(pargs.np, pargs.args,
124 pargs.args_count,
125 &ch->out[i].fwspec);
126 ret = parent_domain->ops->translate(parent_domain,
127 &ch->out[i].fwspec,
128 &unused,
129 &ch->out[i].type);
130 if (ret) {
131 pr_err("%pOF: interrupt %d: error %d extracting type\n",
132 node, i, ret);
133 goto out_free;
134 }
135 if (ch->out[i].type == IRQ_TYPE_NONE) {
136 pr_err("%pOF: interrupt %d: no type\n", node, i);
137 ret = -ENXIO;
138 goto out_free;
139 }
140 }
141
142 domain = irq_domain_create_hierarchy(parent_domain, 0, count,
143 of_node_to_fwnode(node),
144 &changer_domain_ops, ch);
145 if (!domain) {
146 ret = -ENOMEM;
147 goto out_free;
148 }
149
150 return 0;
151
152 out_free:
153 kfree(ch);
154 return ret;
155 }
156

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