soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create

knav_pool_create is an exported function. In the event of a call
before knav_queue_probe, we encounter a NULL pointer dereference
in the following line. Hence return -EPROBE_DEFER to the caller till
the kdev pointer is non-NULL.

Signed-off-by: Keerthy <[email protected]>
Acked-by: Santosh Shilimkar <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
This commit is contained in:
Keerthy 2017-07-31 10:01:36 +05:30 • committed by Arnd Bergmann
commit 4459398b6d

View file

@ -745,6 +745,9 @@ void *knav_pool_create(const char *name,
bool slot_found;
int ret;
if (!kdev)
return ERR_PTR(-EPROBE_DEFER);
if (!kdev->dev)
return ERR_PTR(-ENODEV);