diff options
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/ti-st/st_core.c | 2 | ||||
-rw-r--r-- | drivers/misc/ti-st/st_kim.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index f91f82eabda7..54c91ffe4a91 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c | |||
@@ -605,7 +605,7 @@ long st_unregister(struct st_proto_s *proto) | |||
605 | pr_debug("%s: %d ", __func__, proto->chnl_id); | 605 | pr_debug("%s: %d ", __func__, proto->chnl_id); |
606 | 606 | ||
607 | st_kim_ref(&st_gdata, 0); | 607 | st_kim_ref(&st_gdata, 0); |
608 | if (proto->chnl_id >= ST_MAX_CHANNELS) { | 608 | if (!st_gdata || proto->chnl_id >= ST_MAX_CHANNELS) { |
609 | pr_err(" chnl_id %d not supported", proto->chnl_id); | 609 | pr_err(" chnl_id %d not supported", proto->chnl_id); |
610 | return -EPROTONOSUPPORT; | 610 | return -EPROTONOSUPPORT; |
611 | } | 611 | } |
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 5da93ee6f6be..3613c3bc4da3 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c | |||
@@ -604,6 +604,10 @@ void st_kim_ref(struct st_data_s **core_data, int id) | |||
604 | struct kim_data_s *kim_gdata; | 604 | struct kim_data_s *kim_gdata; |
605 | /* get kim_gdata reference from platform device */ | 605 | /* get kim_gdata reference from platform device */ |
606 | pdev = st_get_plat_device(id); | 606 | pdev = st_get_plat_device(id); |
607 | if (!pdev) { | ||
608 | *core_data = NULL; | ||
609 | return; | ||
610 | } | ||
607 | kim_gdata = dev_get_drvdata(&pdev->dev); | 611 | kim_gdata = dev_get_drvdata(&pdev->dev); |
608 | *core_data = kim_gdata->core_data; | 612 | *core_data = kim_gdata->core_data; |
609 | } | 613 | } |