From 06d223cb4f54543299b96d40a682e33f9147e192 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Fri, 9 Dec 2022 14:35:05 +0100 Subject: [PATCH] fix(io): compare function pointers with NULL The ops->read and ops->write existence was checked with 0, change it to NULL. This corrects sparse issues: drivers/io/io_block.c:272:9: warning: Using plain integer as NULL pointer drivers/io/io_block.c:384:9: warning: Using plain integer as NULL pointer drivers/io/io_block.c:384:9: warning: Using plain integer as NULL pointer Signed-off-by: Yann Gautier Change-Id: I039050a645107523d8263ddf820e539c260d956c --- drivers/io/io_block.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/io/io_block.c b/drivers/io/io_block.c index 5d45c2f17..b5e0e5f72 100644 --- a/drivers/io/io_block.c +++ b/drivers/io/io_block.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2023, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -271,7 +271,7 @@ static int block_read(io_entity_t *entity, uintptr_t buffer, size_t length, block_size = cur->dev_spec->block_size; assert((length <= cur->size) && (length > 0U) && - (ops->read != 0)); + (ops->read != NULL)); /* * We don't know the number of bytes that we are going @@ -383,8 +383,8 @@ static int block_write(io_entity_t *entity, const uintptr_t buffer, block_size = cur->dev_spec->block_size; assert((length <= cur->size) && (length > 0U) && - (ops->read != 0) && - (ops->write != 0)); + (ops->read != NULL) && + (ops->write != NULL)); /* * We don't know the number of bytes that we are going -- 2.39.5