mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-19 11:04:00 +08:00
leds: convert DAC124S085 LED driver to devm_kzalloc()
Cc: Guennadi Liakhovetski <lg@denx.de> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
This commit is contained in:
parent
0b873f3d50
commit
e58603122e
@ -69,7 +69,7 @@ static int dac124s085_probe(struct spi_device *spi)
|
|||||||
struct dac124s085_led *led;
|
struct dac124s085_led *led;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
dac = kzalloc(sizeof(*dac), GFP_KERNEL);
|
dac = devm_kzalloc(&spi->dev, sizeof(*dac), GFP_KERNEL);
|
||||||
if (!dac)
|
if (!dac)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -102,7 +102,6 @@ eledcr:
|
|||||||
led_classdev_unregister(&dac->leds[i].ldev);
|
led_classdev_unregister(&dac->leds[i].ldev);
|
||||||
|
|
||||||
spi_set_drvdata(spi, NULL);
|
spi_set_drvdata(spi, NULL);
|
||||||
kfree(dac);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +116,6 @@ static int dac124s085_remove(struct spi_device *spi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spi_set_drvdata(spi, NULL);
|
spi_set_drvdata(spi, NULL);
|
||||||
kfree(dac);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user