Skip to content

Commit aa3f93c

Browse files
dma-buf: fix compare in WARN_ON_ONCE
Smatch pointed out this trivial typo: drivers/dma-buf/dma-buf.c:1123 dma_buf_map_attachment() warn: passing positive error code '16' to 'ERR_PTR' drivers/dma-buf/dma-buf.c 1113 dma_resv_assert_held(attach->dmabuf->resv); 1114 1115 if (dma_buf_pin_on_map(attach)) { 1116 ret = attach->dmabuf->ops->pin(attach); 1117 /* 1118 * Catch exporters making buffers inaccessible even when 1119 * attachments preventing that exist. 1120 */ 1121 WARN_ON_ONCE(ret == EBUSY); ^^^^^ This was probably intended to be -EBUSY? 1122 if (ret) --> 1123 return ERR_PTR(ret); ^^^ Otherwise we will eventually crash. 1124 } 1125 1126 sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction); 1127 if (!sg_table) 1128 sg_table = ERR_PTR(-ENOMEM); 1129 if (IS_ERR(sg_table)) 1130 goto error_unpin; 1131 Signed-off-by: Christian König <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b8d3291 commit aa3f93c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
11181118
* Catch exporters making buffers inaccessible even when
11191119
* attachments preventing that exist.
11201120
*/
1121-
WARN_ON_ONCE(ret == EBUSY);
1121+
WARN_ON_ONCE(ret == -EBUSY);
11221122
if (ret)
11231123
return ERR_PTR(ret);
11241124
}

0 commit comments

Comments
 (0)