kernel/svc: Simplify thread core ID sanitizing in CreateThread
Rather than use a switch here, this can be collapsed into a simple range check, which is a little easier on the eyes.
This commit is contained in:
		
							parent
							
								
									e5dfbe22ee
								
							
						
					
					
						commit
						205e6d3b97
					
				@ -1233,13 +1233,7 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
 | 
				
			|||||||
        ASSERT(processor_id != THREADPROCESSORID_IDEAL);
 | 
					        ASSERT(processor_id != THREADPROCESSORID_IDEAL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch (processor_id) {
 | 
					    if (processor_id < THREADPROCESSORID_0 || processor_id > THREADPROCESSORID_3) {
 | 
				
			||||||
    case THREADPROCESSORID_0:
 | 
					 | 
				
			||||||
    case THREADPROCESSORID_1:
 | 
					 | 
				
			||||||
    case THREADPROCESSORID_2:
 | 
					 | 
				
			||||||
    case THREADPROCESSORID_3:
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    default:
 | 
					 | 
				
			||||||
        LOG_ERROR(Kernel_SVC, "Invalid thread processor ID: {}", processor_id);
 | 
					        LOG_ERROR(Kernel_SVC, "Invalid thread processor ID: {}", processor_id);
 | 
				
			||||||
        return ERR_INVALID_PROCESSOR_ID;
 | 
					        return ERR_INVALID_PROCESSOR_ID;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user