File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -424,7 +424,6 @@ int cxl_dpa_set_mode(struct cxl_endpoint_decoder *cxled,
424
424
struct cxl_memdev * cxlmd = cxled_to_memdev (cxled );
425
425
struct cxl_dev_state * cxlds = cxlmd -> cxlds ;
426
426
struct device * dev = & cxled -> cxld .dev ;
427
- int rc ;
428
427
429
428
switch (mode ) {
430
429
case CXL_DECODER_RAM :
@@ -435,33 +434,25 @@ int cxl_dpa_set_mode(struct cxl_endpoint_decoder *cxled,
435
434
return - EINVAL ;
436
435
}
437
436
438
- down_write (& cxl_dpa_rwsem );
439
- if (cxled -> cxld .flags & CXL_DECODER_F_ENABLE ) {
440
- rc = - EBUSY ;
441
- goto out ;
442
- }
437
+ guard (rwsem_write )(& cxl_dpa_rwsem );
438
+ if (cxled -> cxld .flags & CXL_DECODER_F_ENABLE )
439
+ return - EBUSY ;
443
440
444
441
/*
445
442
* Only allow modes that are supported by the current partition
446
443
* configuration
447
444
*/
448
445
if (mode == CXL_DECODER_PMEM && !resource_size (& cxlds -> pmem_res )) {
449
446
dev_dbg (dev , "no available pmem capacity\n" );
450
- rc = - ENXIO ;
451
- goto out ;
447
+ return - ENXIO ;
452
448
}
453
449
if (mode == CXL_DECODER_RAM && !resource_size (& cxlds -> ram_res )) {
454
450
dev_dbg (dev , "no available ram capacity\n" );
455
- rc = - ENXIO ;
456
- goto out ;
451
+ return - ENXIO ;
457
452
}
458
453
459
454
cxled -> mode = mode ;
460
- rc = 0 ;
461
- out :
462
- up_write (& cxl_dpa_rwsem );
463
-
464
- return rc ;
455
+ return 0 ;
465
456
}
466
457
467
458
int cxl_dpa_alloc (struct cxl_endpoint_decoder * cxled , unsigned long long size )
You can’t perform that action at this time.
0 commit comments