diff --git a/drivers/soc/qcom/smcinvoke.c b/drivers/soc/qcom/smcinvoke.c index fcd929143a393..73f17e15da9fd 100644 --- a/drivers/soc/qcom/smcinvoke.c +++ b/drivers/soc/qcom/smcinvoke.c @@ -617,15 +617,13 @@ static uint16_t get_server_id(int cb_server_fd) struct smcinvoke_file_data *svr_cxt = NULL; struct file *tmp_filp = fget(cb_server_fd); - if (!tmp_filp) + if (!tmp_filp || !FILE_IS_REMOTE_OBJ(tmp_filp)) return server_id; svr_cxt = tmp_filp->private_data; if (svr_cxt && svr_cxt->context_type == SMCINVOKE_OBJ_TYPE_SERVER) server_id = svr_cxt->server_id; - - if (tmp_filp) - fput(tmp_filp); + fput(tmp_filp); return server_id; }