[PATCH] staging: greybus: fix coccinelle false positive on potential NULL dereference
From: Pei Xiao
Date: Tue Jul 28 2026 - 04:58:06 EST
In gb_bootrom_get_firmware(), when fw is NULL, ret is already set to
ERRNO before jumping to the queue_work label, so !ret is always
false and fw->size is never dereferenced. Add an explicit NULL check
to silence a coccinelle false positive warning.
Signed-off-by: Pei Xiao <xiaopei01@xxxxxxxxxx>
---
drivers/staging/greybus/bootrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
index 83921d90c322..50c80475d241 100644
--- a/drivers/staging/greybus/bootrom.c
+++ b/drivers/staging/greybus/bootrom.c
@@ -298,7 +298,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
queue_work:
/* Refresh timeout */
- if (!ret && (offset + size == fw->size))
+ if (!ret && fw && (offset + size == fw->size))
next_request = NEXT_REQ_READY_TO_BOOT;
else
next_request = NEXT_REQ_GET_FIRMWARE;
--
2.25.1