File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -1490,10 +1490,8 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
1490
1490
return - EINVAL ;
1491
1491
1492
1492
dump = vzalloc (sizeof (* dump ));
1493
- if (!dump ) {
1494
- ret = - ENOMEM ;
1495
- goto out_err ;
1496
- }
1493
+ if (!dump )
1494
+ return - ENOMEM ;
1497
1495
1498
1496
/* Keep size of the buffer page aligned so that it can be mmaped */
1499
1497
data_size = roundup (sizeof (struct vmcoredd_header ) + data -> size ,
@@ -1519,22 +1517,19 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
1519
1517
dump -> size = data_size ;
1520
1518
1521
1519
/* Add the dump to driver sysfs list and update the elfcore hdr */
1522
- mutex_lock ( & vmcore_mutex );
1523
- if (vmcore_opened )
1524
- pr_warn_once ("Unexpected adding of device dump\n" );
1525
- if (vmcore_open ) {
1526
- ret = - EBUSY ;
1527
- goto unlock ;
1528
- }
1520
+ scoped_guard ( mutex , & vmcore_mutex ) {
1521
+ if (vmcore_opened )
1522
+ pr_warn_once ("Unexpected adding of device dump\n" );
1523
+ if (vmcore_open ) {
1524
+ ret = - EBUSY ;
1525
+ goto out_err ;
1526
+ }
1529
1527
1530
- list_add_tail (& dump -> list , & vmcoredd_list );
1531
- vmcoredd_update_size (data_size );
1532
- mutex_unlock ( & vmcore_mutex );
1528
+ list_add_tail (& dump -> list , & vmcoredd_list );
1529
+ vmcoredd_update_size (data_size );
1530
+ }
1533
1531
return 0 ;
1534
1532
1535
- unlock :
1536
- mutex_unlock (& vmcore_mutex );
1537
-
1538
1533
out_err :
1539
1534
vfree (buf );
1540
1535
vfree (dump );
You can’t perform that action at this time.
0 commit comments