Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26c06046 authored by Himangi Saraogi's avatar Himangi Saraogi Committed by John W. Linville
Browse files

cw1200: Introduce the use of devm_kzalloc



This patch introduces the use of devm_kzalloc and does away with the
kfrees in the probe and remove functions.

Signed-off-by: default avatarHimangi Saraogi <himangi774@gmail.com>
Acked-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6040aa70
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -398,7 +398,7 @@ static int cw1200_spi_probe(struct spi_device *func)
		return -1;
		return -1;
	}
	}


	self = kzalloc(sizeof(*self), GFP_KERNEL);
	self = devm_kzalloc(&func->dev, sizeof(*self), GFP_KERNEL);
	if (!self) {
	if (!self) {
		pr_err("Can't allocate SPI hwbus_priv.");
		pr_err("Can't allocate SPI hwbus_priv.");
		return -ENOMEM;
		return -ENOMEM;
@@ -424,7 +424,6 @@ static int cw1200_spi_probe(struct spi_device *func)
	if (status) {
	if (status) {
		cw1200_spi_irq_unsubscribe(self);
		cw1200_spi_irq_unsubscribe(self);
		cw1200_spi_off(plat_data);
		cw1200_spi_off(plat_data);
		kfree(self);
	}
	}


	return status;
	return status;
@@ -441,7 +440,6 @@ static int cw1200_spi_disconnect(struct spi_device *func)
			cw1200_core_release(self->core);
			cw1200_core_release(self->core);
			self->core = NULL;
			self->core = NULL;
		}
		}
		kfree(self);
	}
	}
	cw1200_spi_off(dev_get_platdata(&func->dev));
	cw1200_spi_off(dev_get_platdata(&func->dev));