summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-04-12 19:10:12 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-16 08:26:50 +0300
commitb4e964f84c1a44b0c63a5036efb24cf0f938db0a (patch)
tree6a923d987e6f265bcd966d5cc5e1cd608e6110af /drivers/misc
parent39d2a7898d7fb61276ec766046940dda9080fd4b (diff)
downloadlinux-b4e964f84c1a44b0c63a5036efb24cf0f938db0a.tar.xz
habanalabs/gaudi: Fix uninitialized return code rc when read size is zero
In the case where size is zero the while loop never assigns rc and the return value is uninitialized. Fix this by initializing rc to zero. Fixes: 639781dcab82 ("habanalabs/gaudi: add debugfs to DMA from the device") Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Colin Ian King <colin.king@canonical.com> Addresses-Coverity: ("Uninitialized scalar variable") Link: https://lore.kernel.org/r/20210412161012.1628202-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/gaudi/gaudi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index 8730b691ec61..b751652f80a8 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -6252,7 +6252,7 @@ static int gaudi_debugfs_read_dma(struct hl_device *hdev, u64 addr, u32 size,
dma_addr_t dma_addr;
void *kernel_addr;
bool is_eng_idle;
- int rc, dma_id;
+ int rc = 0, dma_id;
kernel_addr = hdev->asic_funcs->asic_dma_alloc_coherent(
hdev, SZ_2M,