wifi: iwlegacy: Add null pointer check to il_leds_init()

kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.

Cc: Kunwu Chan <kunwu.chan@hotmail.com>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231211033019.238149-1-chentao@kylinos.cn
This commit is contained in:
Kunwu Chan 2023-12-11 11:30:19 +08:00 committed by Kalle Valo
parent 0a999d82b7
commit afd549903e

View file

@ -541,6 +541,9 @@ il_leds_init(struct il_priv *il)
il->led.name =
kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy));
if (!il->led.name)
return;
il->led.brightness_set = il_led_brightness_set;
il->led.blink_set = il_led_blink_set;
il->led.max_brightness = 1;