Add extra sanity checks to prevent the caller getting the invalid result from
imsic_get_data() or imsic_get_target_file() when imsic is not initialized
correctly.
Signed-off-by: Cyan Yang <cyan.yang@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
{
struct sbi_scratch *scratch;
+ if (!imsic_ptr_offset)
+ return NULL;
+
scratch = sbi_hartid_to_scratch(hartid);
if (!scratch)
return NULL;
{
struct sbi_scratch *scratch;
+ if (!imsic_file_offset)
+ return SBI_ENOENT;
+
scratch = sbi_hartid_to_scratch(hartid);
if (!scratch)
return SBI_ENOENT;