|
@@ -1,5 +1,5 @@
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
-/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
|
|
|
+/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
|
|
|
*/
|
|
|
#include <linux/bitops.h>
|
|
|
#include <linux/kernel.h>
|
|
@@ -525,7 +525,7 @@ static int wcd9xxx_irq_setup_downstream_irq(
|
|
|
int wcd9xxx_irq_init(struct wcd9xxx_core_resource *wcd9xxx_res)
|
|
|
{
|
|
|
int i, ret;
|
|
|
- u8 irq_level[wcd9xxx_res->num_irq_regs];
|
|
|
+ u8 *irq_level = NULL;
|
|
|
struct irq_domain *domain;
|
|
|
struct device_node *pnode;
|
|
|
|
|
@@ -555,9 +555,7 @@ int wcd9xxx_irq_init(struct wcd9xxx_core_resource *wcd9xxx_res)
|
|
|
ret = wcd9xxx_irq_setup_downstream_irq(wcd9xxx_res);
|
|
|
if (ret) {
|
|
|
pr_err("%s: Failed to setup downstream IRQ\n", __func__);
|
|
|
- wcd9xxx_irq_put_upstream_irq(wcd9xxx_res);
|
|
|
- mutex_destroy(&wcd9xxx_res->irq_lock);
|
|
|
- mutex_destroy(&wcd9xxx_res->nested_irq_lock);
|
|
|
+ goto fail_irq_level;
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -565,7 +563,11 @@ int wcd9xxx_irq_init(struct wcd9xxx_core_resource *wcd9xxx_res)
|
|
|
wcd9xxx_res->irq_level_high[0] = true;
|
|
|
|
|
|
/* mask all the interrupts */
|
|
|
- memset(irq_level, 0, wcd9xxx_res->num_irq_regs);
|
|
|
+ irq_level = kzalloc(wcd9xxx_res->num_irq_regs, GFP_KERNEL);
|
|
|
+ if (!irq_level) {
|
|
|
+ ret = -ENOMEM;
|
|
|
+ goto fail_irq_level;
|
|
|
+ }
|
|
|
for (i = 0; i < wcd9xxx_res->num_irqs; i++) {
|
|
|
wcd9xxx_res->irq_masks_cur[BIT_BYTE(i)] |= BYTE_BIT_MASK(i);
|
|
|
wcd9xxx_res->irq_masks_cache[BIT_BYTE(i)] |= BYTE_BIT_MASK(i);
|
|
@@ -610,11 +612,14 @@ int wcd9xxx_irq_init(struct wcd9xxx_core_resource *wcd9xxx_res)
|
|
|
if (ret)
|
|
|
goto fail_irq_init;
|
|
|
|
|
|
+ kfree(irq_level);
|
|
|
return ret;
|
|
|
|
|
|
fail_irq_init:
|
|
|
dev_err(wcd9xxx_res->dev,
|
|
|
"%s: Failed to init wcd9xxx irq\n", __func__);
|
|
|
+ kfree(irq_level);
|
|
|
+fail_irq_level:
|
|
|
wcd9xxx_irq_put_upstream_irq(wcd9xxx_res);
|
|
|
mutex_destroy(&wcd9xxx_res->irq_lock);
|
|
|
mutex_destroy(&wcd9xxx_res->nested_irq_lock);
|