diff mbox series

[kvm-unit-tests,v2,1/1] s390x: sclp: consider monoprocessor on read_info error

Message ID 20230427075450.6146-2-pmorel@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Fixing infinite loop on SCLP READ SCP INFO error | expand

Commit Message

Pierre Morel April 27, 2023, 7:54 a.m. UTC
A test would hang if an abort happens before SCLP Read SCP
Information has completed.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 lib/s390x/sclp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Nico Boehr May 24, 2023, 8:33 a.m. UTC | #1
Quoting Pierre Morel (2023-04-27 09:54:50)
[...]
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> index 390fde7..07523dc 100644
> --- a/lib/s390x/sclp.c
> +++ b/lib/s390x/sclp.c
> @@ -119,8 +119,9 @@ void sclp_read_info(void)
>  
>  int sclp_get_cpu_num(void)
>  {
> -       assert(read_info);
> -       return read_info->entries_cpu;
> +    if (read_info)
> +           return read_info->entries_cpu;
> +    return 1;

tab/spaces are mixed up here, please fix that.
Pierre Morel May 30, 2023, 11:37 a.m. UTC | #2
On 5/24/23 10:33, Nico Boehr wrote:
> Quoting Pierre Morel (2023-04-27 09:54:50)
> [...]
>> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
>> index 390fde7..07523dc 100644
>> --- a/lib/s390x/sclp.c
>> +++ b/lib/s390x/sclp.c
>> @@ -119,8 +119,9 @@ void sclp_read_info(void)
>>   
>>   int sclp_get_cpu_num(void)
>>   {
>> -       assert(read_info);
>> -       return read_info->entries_cpu;
>> +    if (read_info)
>> +           return read_info->entries_cpu;
>> +    return 1;
> tab/spaces are mixed up here, please fix that.
/o\ yes
diff mbox series

Patch

diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index 390fde7..07523dc 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -119,8 +119,9 @@  void sclp_read_info(void)
 
 int sclp_get_cpu_num(void)
 {
-	assert(read_info);
-	return read_info->entries_cpu;
+    if (read_info)
+	    return read_info->entries_cpu;
+    return 1;
 }
 
 CPUEntry *sclp_get_cpu_entries(void)