* re: pinctrl: mediatek: emulate GPIO interrupt on both-edges
@ 2015-03-13 8:38 Dan Carpenter
2015-03-13 13:48 ` Yingjoe Chen
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-03-13 8:38 UTC (permalink / raw)
To: yingjoe.chen; +Cc: linux-gpio
Hello Yingjoe Chen,
The patch c3a785c1b041: "pinctrl: mediatek: emulate GPIO interrupt on
both-edges" from Jan 27, 2015, leads to the following static checker
warning:
drivers/pinctrl/mediatek/pinctrl-mtk-common.c:1252 mtk_pctrl_init()
warn: passing devm_ allocated variable to kfree. 'pctl->eint_dual_edges'
drivers/pinctrl/mediatek/pinctrl-mtk-common.c
1213
1214 pctl->eint_dual_edges = devm_kzalloc(&pdev->dev,
^^^^^^^^^^^^
1215 sizeof(int) * pctl->devdata->ap_num, GFP_KERNEL);
1216 if (!pctl->eint_dual_edges) {
1217 ret = -ENOMEM;
1218 goto chip_error;
1219 }
1220
1221 irq = irq_of_parse_and_map(np, 0);
1222 if (!irq) {
1223 dev_err(&pdev->dev, "couldn't parse and map irq\n");
1224 ret = -EINVAL;
1225 goto free_edges;
1226 }
1227
1228 pctl->domain = irq_domain_add_linear(np,
1229 pctl->devdata->ap_num, &irq_domain_simple_ops, NULL);
1230 if (!pctl->domain) {
1231 dev_err(&pdev->dev, "Couldn't register IRQ domain\n");
1232 ret = -ENOMEM;
1233 goto free_edges;
1234 }
1235
1236 mtk_eint_init(pctl);
1237 for (i = 0; i < pctl->devdata->ap_num; i++) {
1238 int virq = irq_create_mapping(pctl->domain, i);
1239
1240 irq_set_chip_and_handler(virq, &mtk_pinctrl_irq_chip,
1241 handle_level_irq);
1242 irq_set_chip_data(virq, pctl);
1243 set_irq_flags(virq, IRQF_VALID);
1244 };
1245
1246 irq_set_chained_handler(irq, mtk_eint_irq_handler);
1247 irq_set_handler_data(irq, pctl);
1248 set_irq_flags(irq, IRQF_VALID);
1249 return 0;
1250
1251 free_edges:
1252 kfree(pctl->eint_dual_edges);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This causes a double free. You can just leave it out since devm_
pointers are freed automatically.
1253 chip_error:
1254 gpiochip_remove(pctl->chip);
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* re: pinctrl: mediatek: emulate GPIO interrupt on both-edges
2015-03-13 8:38 pinctrl: mediatek: emulate GPIO interrupt on both-edges Dan Carpenter
@ 2015-03-13 13:48 ` Yingjoe Chen
0 siblings, 0 replies; 2+ messages in thread
From: Yingjoe Chen @ 2015-03-13 13:48 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-gpio, Axel Lin
On Fri, 2015-03-13 at 11:38 +0300, Dan Carpenter wrote:
> Hello Yingjoe Chen,
>
> The patch c3a785c1b041: "pinctrl: mediatek: emulate GPIO interrupt on
> both-edges" from Jan 27, 2015, leads to the following static checker
> warning:
>
> drivers/pinctrl/mediatek/pinctrl-mtk-common.c:1252 mtk_pctrl_init()
> warn: passing devm_ allocated variable to kfree. 'pctl->eint_dual_edges'
Hi,
Thanks for catching this. It seems Axel already post a fix for me:
http://article.gmane.org/gmane.linux.kernel.gpio/6789
Joe.C
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-13 13:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-13 8:38 pinctrl: mediatek: emulate GPIO interrupt on both-edges Dan Carpenter
2015-03-13 13:48 ` Yingjoe Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).