FROMLIST: media: venus: Fix NULL pointer dereference in core selection

The newly-introduced function min_loaded_core() iterates over all of
the venus instances an tries to figure out how much load each instance
is putting on each core.  Not all instances, however, might be fully
initialized.  Specifically the "codec_freq_data" is initialized as
part of vdec_queue_setup(), but an instance may already be in the list
of all instances before that time.

Let's band-aid this by checking to see if codec_freq_data is NULL
before dereferencing.

NOTE: without this fix I was running into a crash.  Specifically there
were two venus instances.  One was doing start_streaming.  The other
was midway through queue_setup but hadn't yet gotten to initting
"codec_freq_data".

Fixes: eff82f79c562 ("media: venus: introduce core selection")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(am from https://lore.kernel.org/patchwork/patch/1251310/)
(also found at https://lkml.kernel.org/r/20200601150314.RFC.1.I1e40623bbe8fa43ff1415fc273cba66503b9b048@changeid)

BUG=b:157938030
TEST=Login without crashing now

Change-Id: I1e40623bbe8fa43ff1415fc273cba66503b9b048
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2225393
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
1 file changed