@@ -45,6 +45,7 @@ struct test_batched_req {
45
45
bool sent ;
46
46
const struct firmware * fw ;
47
47
const char * name ;
48
+ const char * fw_buf ;
48
49
struct completion completion ;
49
50
struct task_struct * task ;
50
51
struct device * dev ;
@@ -175,8 +176,14 @@ static void __test_release_all_firmware(void)
175
176
176
177
for (i = 0 ; i < test_fw_config -> num_requests ; i ++ ) {
177
178
req = & test_fw_config -> reqs [i ];
178
- if (req -> fw )
179
+ if (req -> fw ) {
180
+ if (req -> fw_buf ) {
181
+ kfree_const (req -> fw_buf );
182
+ req -> fw_buf = NULL ;
183
+ }
179
184
release_firmware (req -> fw );
185
+ req -> fw = NULL ;
186
+ }
180
187
}
181
188
182
189
vfree (test_fw_config -> reqs );
@@ -670,6 +677,8 @@ static ssize_t trigger_request_store(struct device *dev,
670
677
671
678
mutex_lock (& test_fw_mutex );
672
679
release_firmware (test_firmware );
680
+ if (test_fw_config -> reqs )
681
+ __test_release_all_firmware ();
673
682
test_firmware = NULL ;
674
683
rc = request_firmware (& test_firmware , name , dev );
675
684
if (rc ) {
@@ -770,6 +779,8 @@ static ssize_t trigger_async_request_store(struct device *dev,
770
779
mutex_lock (& test_fw_mutex );
771
780
release_firmware (test_firmware );
772
781
test_firmware = NULL ;
782
+ if (test_fw_config -> reqs )
783
+ __test_release_all_firmware ();
773
784
rc = request_firmware_nowait (THIS_MODULE , 1 , name , dev , GFP_KERNEL ,
774
785
NULL , trigger_async_request_cb );
775
786
if (rc ) {
@@ -812,6 +823,8 @@ static ssize_t trigger_custom_fallback_store(struct device *dev,
812
823
813
824
mutex_lock (& test_fw_mutex );
814
825
release_firmware (test_firmware );
826
+ if (test_fw_config -> reqs )
827
+ __test_release_all_firmware ();
815
828
test_firmware = NULL ;
816
829
rc = request_firmware_nowait (THIS_MODULE , FW_ACTION_NOUEVENT , name ,
817
830
dev , GFP_KERNEL , NULL ,
@@ -874,6 +887,8 @@ static int test_fw_run_batch_request(void *data)
874
887
test_fw_config -> buf_size );
875
888
if (!req -> fw )
876
889
kfree (test_buf );
890
+ else
891
+ req -> fw_buf = test_buf ;
877
892
} else {
878
893
req -> rc = test_fw_config -> req_firmware (& req -> fw ,
879
894
req -> name ,
@@ -934,6 +949,7 @@ static ssize_t trigger_batched_requests_store(struct device *dev,
934
949
req -> fw = NULL ;
935
950
req -> idx = i ;
936
951
req -> name = test_fw_config -> name ;
952
+ req -> fw_buf = NULL ;
937
953
req -> dev = dev ;
938
954
init_completion (& req -> completion );
939
955
req -> task = kthread_run (test_fw_run_batch_request , req ,
@@ -1038,6 +1054,7 @@ ssize_t trigger_batched_requests_async_store(struct device *dev,
1038
1054
for (i = 0 ; i < test_fw_config -> num_requests ; i ++ ) {
1039
1055
req = & test_fw_config -> reqs [i ];
1040
1056
req -> name = test_fw_config -> name ;
1057
+ req -> fw_buf = NULL ;
1041
1058
req -> fw = NULL ;
1042
1059
req -> idx = i ;
1043
1060
init_completion (& req -> completion );
0 commit comments