Skip to content

Commit fb26ed2

Browse files
ekanshibuquic-vkatoch
authored andcommitted
FROMLIST: misc: fastrpc: Allow fastrpc_buf_free() to accept NULL
Make fastrpc_buf_free() a no-op when passed a NULL pointer, allowing callers to avoid open-coded NULL checks. Link: https://lore.kernel.org/all/20260526111124.515-6-jianping.li@oss.qualcomm.com/ Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com> Signed-off-by: Jianping Li <jianping.li@oss.qualcomm.com> Signed-off-by: Vinayak Katoch <vkatoch@qti.qualcomm.com>
1 parent 97a6764 commit fb26ed2

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/misc/fastrpc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,7 @@ static void fastrpc_context_free(struct kref *ref)
585585
for (i = 0; i < ctx->nbufs; i++)
586586
fastrpc_map_put(ctx->maps[i]);
587587

588-
if (ctx->buf)
589-
fastrpc_buf_free(ctx->buf);
588+
fastrpc_buf_free(ctx->buf);
590589

591590
spin_lock_irqsave(&cctx->lock, flags);
592591
idr_remove(&cctx->ctx_idr, FIELD_GET(FASTRPC_CTXID_MASK, ctx->ctxid));
@@ -1735,8 +1734,7 @@ static int fastrpc_device_release(struct inode *inode, struct file *file)
17351734
list_del(&fl->user);
17361735
spin_unlock_irqrestore(&cctx->lock, flags);
17371736

1738-
if (fl->init_mem)
1739-
fastrpc_buf_free(fl->init_mem);
1737+
fastrpc_buf_free(fl->init_mem);
17401738

17411739
list_for_each_entry_safe(ctx, n, &fl->pending, node) {
17421740
list_del(&ctx->node);

0 commit comments

Comments
 (0)