mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 22:02:28 +00:00
50e7a31d30
Smatch static checker warns that "mdev" can be null: sound/usb/media.c:287 snd_media_device_create() warn: 'mdev' can also be NULL If CONFIG_MEDIA_CONTROLLER is disabled, this file should not be included in the build. The below conditions in the sound/usb/Makefile are in place to ensure that media.c isn't included in the build. sound/usb/Makefile: snd-usb-audio-$(CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER) += media.o select SND_USB_AUDIO_USE_MEDIA_CONTROLLER if MEDIA_CONTROLLER && (MEDIA_SUPPORT=y || MEDIA_SUPPORT=SND_USB_AUDIO) The following config check in include/media/media-dev-allocator.h is in place to enable the API only when CONFIG_MEDIA_CONTROLLER and CONFIG_USB are enabled. #if defined(CONFIG_MEDIA_CONTROLLER) && defined(CONFIG_USB) This check doesn't work as intended when CONFIG_USB=m. When CONFIG_USB=m, CONFIG_USB_MODULE is defined and CONFIG_USB is not. The above config check doesn't catch that CONFIG_USB is defined as a module and disables the API. This results in sound/usb enabling Media Controller specific ALSA driver code, while Media disables the Media Controller API. Fix the problem requires two changes: 1. Change the check to use IS_ENABLED to detect when CONFIG_USB is enabled as a module or static. Since CONFIG_MEDIA_CONTROLLER is a bool, leave the check unchanged to be consistent with drivers/media/Makefile. 2. Change the drivers/media/mc/Makefile to include mc-dev-allocator.o in mc-objs when CONFIG_USB is enabled. Link: https://lore.kernel.org/alsa-devel/YLeAvT+R22FQ%2FEyw@mwanda/ Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
||
---|---|---|
.. | ||
davinci | ||
drv-intf | ||
i2c | ||
tpg | ||
cec-notifier.h | ||
cec-pin.h | ||
cec.h | ||
demux.h | ||
dmxdev.h | ||
dvb_ca_en50221.h | ||
dvb_demux.h | ||
dvb_frontend.h | ||
dvb_math.h | ||
dvb_net.h | ||
dvb_ringbuffer.h | ||
dvb_vb2.h | ||
dvb-usb-ids.h | ||
dvbdev.h | ||
frame_vector.h | ||
hevc-ctrls.h | ||
imx.h | ||
media-dev-allocator.h | ||
media-device.h | ||
media-devnode.h | ||
media-entity.h | ||
media-request.h | ||
rc-core.h | ||
rc-map.h | ||
rcar-fcp.h | ||
tuner-types.h | ||
tuner.h | ||
tveeprom.h | ||
v4l2-async.h | ||
v4l2-common.h | ||
v4l2-ctrls.h | ||
v4l2-dev.h | ||
v4l2-device.h | ||
v4l2-dv-timings.h | ||
v4l2-event.h | ||
v4l2-fh.h | ||
v4l2-flash-led-class.h | ||
v4l2-fwnode.h | ||
v4l2-h264.h | ||
v4l2-image-sizes.h | ||
v4l2-ioctl.h | ||
v4l2-jpeg.h | ||
v4l2-mc.h | ||
v4l2-mediabus.h | ||
v4l2-mem2mem.h | ||
v4l2-rect.h | ||
v4l2-subdev.h | ||
videobuf2-core.h | ||
videobuf2-dma-contig.h | ||
videobuf2-dma-sg.h | ||
videobuf2-dvb.h | ||
videobuf2-memops.h | ||
videobuf2-v4l2.h | ||
videobuf2-vmalloc.h | ||
videobuf-core.h | ||
videobuf-dma-contig.h | ||
videobuf-dma-sg.h | ||
videobuf-vmalloc.h | ||
vsp1.h |