linux-stable/drivers/staging/greybus
Dan Carpenter 1d4ff6a8f8 staging: greybus: fix get_channel_from_mode() failure path
[ Upstream commit 34164202a5 ]

The get_channel_from_mode() function is supposed to return the channel
which matches the mode.  But it has a bug where if it doesn't find a
matching channel then it returns the last channel.  It should return
NULL instead.

Also remove an unnecessary NULL check on "channel".

Fixes: 2870b52bae ("greybus: lights: add lights implementation")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Link: https://lore.kernel.org/r/379c0cb4-39e0-4293-8a18-c7b1298e5420@moroto.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:20:58 -04:00
..
Documentation
tools
Kconfig
Makefile
TODO
arche-apb-ctrl.c
arche-platform.c
arche_platform.h
audio_apbridgea.c
audio_apbridgea.h
audio_codec.c
audio_codec.h
audio_gb.c
audio_helper.c
audio_helper.h
audio_manager.c
audio_manager.h
audio_manager_module.c
audio_manager_private.h
audio_manager_sysfs.c
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
light.c
log.c
loopback.c
power_supply.c
pwm.c
raw.c
sdio.c
spi.c
spilib.c
spilib.h
uart.c
usb.c
vibrator.c