forked from Minki/linux
2e81948177
As the possible alloc failure of devm_kcalloc(), it could return null
pointer.
Therefore, 'strings' should be checked and return NULL if alloc fails to
prevent the dereference of the NULL pointer.
Also, the caller should also deal with the return value of the
gb_generate_enum_strings() and return -ENOMEM if returns NULL.
Moreover, because the memory allocated with devm_kzalloc() will be
freed automatically when the last reference to the device is dropped,
the 'gbe' in gbaudio_tplg_create_enum_kctl() and
gbaudio_tplg_create_enum_ctl() do not need to free manually.
But the 'control' in gbaudio_tplg_create_widget() and
gbaudio_tplg_process_kcontrols() has a specially error handle to
cleanup.
So it should be better to cleanup 'control' when fails.
Fixes:
|
||
---|---|---|
.. | ||
Documentation | ||
tools | ||
arche_platform.h | ||
arche-apb-ctrl.c | ||
arche-platform.c | ||
audio_apbridgea.c | ||
audio_apbridgea.h | ||
audio_codec.c | ||
audio_codec.h | ||
audio_gb.c | ||
audio_helper.c | ||
audio_helper.h | ||
audio_manager_module.c | ||
audio_manager_private.h | ||
audio_manager_sysfs.c | ||
audio_manager.c | ||
audio_manager.h | ||
audio_module.c | ||
audio_topology.c | ||
authentication.c | ||
bootrom.c | ||
camera.c | ||
firmware.h | ||
fw-core.c | ||
fw-download.c | ||
fw-management.c | ||
gb-camera.h | ||
gbphy.c | ||
gbphy.h | ||
gpio.c | ||
greybus_authentication.h | ||
greybus_firmware.h | ||
hid.c | ||
i2c.c | ||
Kconfig | ||
light.c | ||
log.c | ||
loopback.c | ||
Makefile | ||
power_supply.c | ||
pwm.c | ||
raw.c | ||
sdio.c | ||
spi.c | ||
spilib.c | ||
spilib.h | ||
TODO | ||
uart.c | ||
usb.c | ||
vibrator.c |