On 6/2/21 6:59 AM, Dan Carpenter wrote:
Hello Shuah Khan,
The patch 66354f18fe5f: "media: sound/usb: Use Media Controller API
to share media resources" from Apr 1, 2019, leads to the following
static checker warning:
sound/usb/media.c:287 snd_media_device_create()
warn: 'mdev' can also be NULL
sound/usb/media.c
270
271 mdev = media_device_usb_allocate(usbdev, KBUILD_MODNAME, THIS_MODULE);
^^^^
If CONFIG_MEDIA_CONTROLLER is disabled then "mdev" is NULL.
If CONFIG_MEDIA_CONTROLLER is disabled, this file won't be compiled.
Please see below clause in the Makefile.
sound/usb/Makefile:
snd-usb-audio-$(CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER) += media.o
Also, this select in sound/usb/Kconfig selects appropriate
configs.
select SND_USB_AUDIO_USE_MEDIA_CONTROLLER if MEDIA_CONTROLLER &&
(MEDIA_SUPPORT=y || MEDIA_SUPPORT=SND_USB_AUDIO)
We are good here with the above in place to make sure media.c
code isn't in play when CONFIG_MEDIA_CONTROLLER is disabled.
thanks,
-- Shuah