Skip to content

Commit 1da3385

Browse files
committed
regmap: irq: Free the regmap-irq mutex
We do not currently free the mutex allocated by regmap-irq, do so. Tested-by: Russell King (Oracle) <[email protected]> Reviewed-by: Russell King (Oracle) <[email protected]> Signed-off-by: Mark Brown <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent ffc7277 commit 1da3385

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

drivers/base/regmap/regmap-irq.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
816816
d->mask_buf[i],
817817
chip->irq_drv_data);
818818
if (ret)
819-
goto err_alloc;
819+
goto err_mutex;
820820
}
821821

822822
if (chip->mask_base && !chip->handle_mask_sync) {
@@ -827,7 +827,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
827827
if (ret) {
828828
dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
829829
reg, ret);
830-
goto err_alloc;
830+
goto err_mutex;
831831
}
832832
}
833833

@@ -838,7 +838,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
838838
if (ret) {
839839
dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
840840
reg, ret);
841-
goto err_alloc;
841+
goto err_mutex;
842842
}
843843
}
844844

@@ -855,7 +855,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
855855
if (ret != 0) {
856856
dev_err(map->dev, "Failed to read IRQ status: %d\n",
857857
ret);
858-
goto err_alloc;
858+
goto err_mutex;
859859
}
860860
}
861861

@@ -879,7 +879,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
879879
if (ret != 0) {
880880
dev_err(map->dev, "Failed to ack 0x%x: %d\n",
881881
reg, ret);
882-
goto err_alloc;
882+
goto err_mutex;
883883
}
884884
}
885885
}
@@ -901,7 +901,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
901901
if (ret != 0) {
902902
dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
903903
reg, ret);
904-
goto err_alloc;
904+
goto err_mutex;
905905
}
906906
}
907907
}
@@ -910,15 +910,15 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
910910
if (chip->status_is_level) {
911911
ret = read_irq_data(d);
912912
if (ret < 0)
913-
goto err_alloc;
913+
goto err_mutex;
914914

915915
memcpy(d->prev_status_buf, d->status_buf,
916916
array_size(d->chip->num_regs, sizeof(d->prev_status_buf[0])));
917917
}
918918

919919
ret = regmap_irq_create_domain(fwnode, irq_base, chip, d);
920920
if (ret)
921-
goto err_alloc;
921+
goto err_mutex;
922922

923923
ret = request_threaded_irq(irq, NULL, regmap_irq_thread,
924924
irq_flags | IRQF_ONESHOT,
@@ -935,6 +935,8 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
935935

936936
err_domain:
937937
/* Should really dispose of the domain but... */
938+
err_mutex:
939+
mutex_destroy(&d->lock);
938940
err_alloc:
939941
kfree(d->type_buf);
940942
kfree(d->type_buf_def);
@@ -1027,6 +1029,7 @@ void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d)
10271029
kfree(d->config_buf[i]);
10281030
kfree(d->config_buf);
10291031
}
1032+
mutex_destroy(&d->lock);
10301033
kfree(d);
10311034
}
10321035
EXPORT_SYMBOL_GPL(regmap_del_irq_chip);

0 commit comments

Comments
 (0)