From 5454bed5760a66e42666f5ceb8ce8f2562a767d2 Mon Sep 17 00:00:00 2001 From: Jeevan Shriram Date: Thu, 13 Jan 2022 10:38:05 -0800 Subject: [PATCH] drivers: soc: spss_utils: Handle error return from copy_to_user Handle error return value from copy_to_user() in ioctls to avoid following compilation failure. "error: ignoring return value of function declared with 'warn_unused_result' attribute". Change-Id: I92944ade7fb88e0543ca4254fab226da5777def7 Signed-off-by: Jeevan Shriram --- drivers/soc/qcom/spss_utils.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/spss_utils.c b/drivers/soc/qcom/spss_utils.c index d947990e00a3..39a209fafade 100644 --- a/drivers/soc/qcom/spss_utils.c +++ b/drivers/soc/qcom/spss_utils.c @@ -557,9 +557,15 @@ static long spss_utils_ioctl(struct file *file, return -EINVAL; } ret = spss_wait_for_event(req); - copy_to_user((void __user *)arg, data, size); if (ret < 0) return ret; + + ret = copy_to_user((void __user *)arg, data, size); + if (ret) { + pr_err("cmd [0x%x] copy_to_user failed - %d\n", cmd, ret); + return ret; + } + break; case SPSS_IOC_SIGNAL_EVENT: @@ -569,9 +575,14 @@ static long spss_utils_ioctl(struct file *file, return -EINVAL; } ret = spss_signal_event(req); - copy_to_user((void __user *)arg, data, size); if (ret < 0) return ret; + + ret = copy_to_user((void __user *)arg, data, size); + if (ret) { + pr_err("cmd [0x%x] copy_to_user failed - %d\n", cmd, ret); + return ret; + } break; case SPSS_IOC_IS_EVENT_SIGNALED: @@ -581,9 +592,15 @@ static long spss_utils_ioctl(struct file *file, return -EINVAL; } ret = spss_is_event_signaled(req); - copy_to_user((void __user *)arg, data, size); if (ret < 0) return ret; + + ret = copy_to_user((void __user *)arg, data, size); + if (ret) { + pr_err("cmd [0x%x] copy_to_user failed - %d\n", cmd, ret); + return ret; + } + break; case SPSS_IOC_SET_SSR_STATE: