Unverified Commit 3f998cd5 authored by Mark Brown's avatar Mark Brown
Browse files

SDCA Bug Fixes

Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>:

Some small SDCA bug fixes reported from various sources. An array bounds
check, an uninitialised variable and some memory allocations that should
zero initialise.

Charles Keepax (3):
  ASoC: SDCA: Fix off by one error in IRQ bound check
  ASoC: SDCA: Avoid use of uninitialised local name variable
  ASoC: SDCA: Update memory allocations to zero initialise

 sound/soc/sdca/sdca_asoc.c       | 12 ++++++------
 sound/soc/sdca/sdca_interrupts.c |  5 ++---
 2 files changed, 8 insertions(+), 9 deletions(-)

--
2.39.5
parents dd10ed1c 15247b5a
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -230,11 +230,11 @@ static int entity_early_parse_ge(struct device *dev,
	if (!control_name)
		return -ENOMEM;

	kctl = devm_kmalloc(dev, sizeof(*kctl), GFP_KERNEL);
	kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL);
	if (!kctl)
		return -ENOMEM;

	soc_enum = devm_kmalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
	soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
	if (!soc_enum)
		return -ENOMEM;

@@ -561,11 +561,11 @@ static int entity_parse_su_class(struct device *dev,
	const char **texts;
	int i;

	kctl = devm_kmalloc(dev, sizeof(*kctl), GFP_KERNEL);
	kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL);
	if (!kctl)
		return -ENOMEM;

	soc_enum = devm_kmalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
	soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
	if (!soc_enum)
		return -ENOMEM;

@@ -672,7 +672,7 @@ static int entity_parse_mu(struct device *dev,
		if (!control_name)
			return -ENOMEM;

		mc = devm_kmalloc(dev, sizeof(*mc), GFP_KERNEL);
		mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL);
		if (!mc)
			return -ENOMEM;

@@ -926,7 +926,7 @@ static int populate_control(struct device *dev,
	if (!control_name)
		return -ENOMEM;

	mc = devm_kmalloc(dev, sizeof(*mc), GFP_KERNEL);
	mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL);
	if (!mc)
		return -ENOMEM;

+2 −3
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ int sdca_irq_request(struct device *dev, struct sdca_interrupt_info *info,
{
	int ret;

	if (sdca_irq < 0 || sdca_irq > SDCA_MAX_INTERRUPTS) {
	if (sdca_irq < 0 || sdca_irq >= SDCA_MAX_INTERRUPTS) {
		dev_err(dev, "bad irq request: %d\n", sdca_irq);
		return -EINVAL;
	}
@@ -342,7 +342,6 @@ int sdca_irq_populate(struct sdca_function_data *function,
			int irq = control->interrupt_position;
			struct sdca_interrupt *interrupt;
			irq_handler_t handler;
			const char *name;
			int ret;

			if (irq == SDCA_NO_INTERRUPT) {
@@ -385,7 +384,7 @@ int sdca_irq_populate(struct sdca_function_data *function,
						      handler, interrupt);
			if (ret) {
				dev_err(dev, "failed to request irq %s: %d\n",
					name, ret);
					interrupt->name, ret);
				return ret;
			}
		}