From: Yu'an Wang wangyuan46@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
1.add input para check of uacce_unregister api 2.change uacce_qfrt_str to internal interface, because it is used just in uacce.c
Signed-off-by: Yu'an Wang wangyuan46@huawei.com Reviewed-by: Longfang Liu liulongfang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/misc/uacce/uacce.c | 6 ++++-- include/linux/uacce.h | 1 - 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index db7b3936aec6f..b0cdc244e882a 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -126,11 +126,10 @@ static void uacce_hw_err_destroy(struct uacce *uacce) } }
-const char *uacce_qfrt_str(struct uacce_qfile_region *qfr) +static const char *uacce_qfrt_str(struct uacce_qfile_region *qfr) { return qfrt_str[qfr->type]; } -EXPORT_SYMBOL_GPL(uacce_qfrt_str);
/** * uacce_wake_up - Wake up the process who is waiting this queue @@ -1302,6 +1301,9 @@ EXPORT_SYMBOL_GPL(uacce_register); */ int uacce_unregister(struct uacce *uacce) { + if (!uacce) + return -ENODEV; + if (atomic_read(&uacce->ref) > 0) { printk_ratelimited("Fail to unregister uacce, please close all uacce queues!\n"); return -EAGAIN; diff --git a/include/linux/uacce.h b/include/linux/uacce.h index 43737c3f7f525..b43b65abdce39 100644 --- a/include/linux/uacce.h +++ b/include/linux/uacce.h @@ -128,7 +128,6 @@ struct uacce { int uacce_register(struct uacce *uacce); int uacce_unregister(struct uacce *uacce); void uacce_wake_up(struct uacce_queue *q); -const char *uacce_qfrt_str(struct uacce_qfile_region *qfr); struct uacce *dev_to_uacce(struct device *dev); int uacce_hw_err_isolate(struct uacce *uacce);