Message ID | 1fd61230aa6e56abc02598768bf0dca10b49cc55.1618126878.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers | show |
Series | None | expand |
diff --git a/drivers/leds/blink/leds-lgm-sso.c b/drivers/leds/blink/leds-lgm-sso.c index 3da242d4ce7d..ef632ebabac9 100644 --- a/drivers/leds/blink/leds-lgm-sso.c +++ b/drivers/leds/blink/leds-lgm-sso.c @@ -631,8 +631,10 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled) fwnode_for_each_child_node(fw_ssoled, fwnode_child) { led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); - if (!led) - return -ENOMEM; + if (!led) { + ret = -ENOMEM; + goto __dt_err; + } INIT_LIST_HEAD(&led->list); led->priv = priv;
If a memory allocation fails, we must free the already allocated resources before returning. Fixes: c3987cd2bca3 ("leds: lgm: Add LED controller driver for LGM SoC") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- drivers/leds/blink/leds-lgm-sso.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)