Skip to content

Commit 24c8f11

Browse files
committed
staging: vc04_services: vc-sm-cma: Fix smatch warnings
Fix these two smatch warnings for the vc-sm-cma driver, rest were false positives: ../vc-sm-cma/vc_sm.c:413 vc_sm_dma_buf_attach() warn: inconsistent returns '&buf->lock'. Locked on : 396 Unlocked on: 413 ../vc-sm-cma/vc_sm.c:1225 vc_sm_cma_ioctl_alloc() error: we previously assumed 'buffer' could be null (see line 1113) Signed-off-by: Jai Luthra <[email protected]>
1 parent 78fd5c9 commit 24c8f11

File tree

1 file changed

+2
-1
lines changed
  • drivers/staging/vc04_services/vc-sm-cma

1 file changed

+2
-1
lines changed

drivers/staging/vc04_services/vc-sm-cma/vc_sm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ static int vc_sm_dma_buf_attach(struct dma_buf *dmabuf,
393393
ret = sg_alloc_table(sgt, buf->alloc.sg_table->orig_nents, GFP_KERNEL);
394394
if (ret) {
395395
kfree(a);
396+
mutex_unlock(&buf->lock);
396397
return -ENOMEM;
397398
}
398399

@@ -1223,7 +1224,7 @@ static int vc_sm_cma_ioctl_alloc(struct vc_sm_privdata_t *private,
12231224
dma_buf_put(dmabuf);
12241225
} else {
12251226
/* No dmabuf, therefore just free the buffer here */
1226-
if (buffer->cookie)
1227+
if (buffer && buffer->cookie)
12271228
dma_free_coherent(&sm_state->device->dev, buffer->size,
12281229
buffer->cookie, buffer->dma_addr);
12291230
kfree(buffer);

0 commit comments

Comments
 (0)