-
-
Save ntrippar/bdd5662e1116d8cd39bd582878ec60df to your computer and use it in GitHub Desktop.
NDAY-2017-0106
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int nvhost_init_error_notifier(struct nvhost_channel *ch, | |
| struct nvhost_set_error_notifier *args) { | |
| void *va; | |
| struct dma_buf *dmabuf; | |
| if (!args->mem) { | |
| dev_err(&ch->dev->dev, "invalid memory handle\n"); | |
| return -EINVAL; | |
| } | |
| dmabuf = dma_buf_get(args->mem); | |
| if (ch->error_notifier_ref) | |
| nvhost_free_error_notifiers(ch); | |
| if (IS_ERR(dmabuf)) { | |
| dev_err(&ch->dev->dev, "Invalid handle: %d\n", args->mem); | |
| return -EINVAL; | |
| } | |
| /* map handle */ | |
| va = dma_buf_vmap(dmabuf); | |
| if (!va) { | |
| dma_buf_put(dmabuf); | |
| dev_err(&ch->dev->dev, "Cannot map notifier handle\n"); | |
| return -ENOMEM; | |
| } | |
| /* set channel notifiers pointer */ | |
| ch->error_notifier_ref = dmabuf; | |
| ch->error_notifier = va + args->offset; | |
| ch->error_notifier_va = va; | |
| memset(ch->error_notifier, 0, sizeof(struct nvhost_notification)); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment