mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
uprobes: simplify error handling for alloc_uprobe()
Return -ENOMEM instead of NULL, which makes caller's error handling just a touch simpler. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> Reviewed-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20240801132719.GA8788@redhat.com
This commit is contained in:
parent
300b05621a
commit
7c2bae2d9c
|
|
@ -725,7 +725,7 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset,
|
|||
|
||||
uprobe = kzalloc(sizeof(struct uprobe), GFP_KERNEL);
|
||||
if (!uprobe)
|
||||
return NULL;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
uprobe->inode = inode;
|
||||
uprobe->offset = offset;
|
||||
|
|
@ -1167,8 +1167,6 @@ static int __uprobe_register(struct inode *inode, loff_t offset,
|
|||
|
||||
retry:
|
||||
uprobe = alloc_uprobe(inode, offset, ref_ctr_offset);
|
||||
if (!uprobe)
|
||||
return -ENOMEM;
|
||||
if (IS_ERR(uprobe))
|
||||
return PTR_ERR(uprobe);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user