Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a09b09ae authored by Roel Kluin's avatar Roel Kluin Committed by Dan Williams
Browse files

iop-adma, mv_xor: fix mem leak on self-test setup failure



iop_adma_zero_sum_self_test has the brackets in the wrong place for the
setup failure deallocation path.  This error was duplicated in
mv_xor_xor_self_test.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 900325a6
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -928,16 +928,16 @@ iop_adma_xor_zero_sum_self_test(struct iop_adma_device *device)


	for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) {
	for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) {
		xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
		xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
		if (!xor_srcs[src_idx])
		if (!xor_srcs[src_idx]) {
			while (src_idx--) {
			while (src_idx--)
				__free_page(xor_srcs[src_idx]);
				__free_page(xor_srcs[src_idx]);
			return -ENOMEM;
			return -ENOMEM;
		}
		}
	}
	}


	dest = alloc_page(GFP_KERNEL);
	dest = alloc_page(GFP_KERNEL);
	if (!dest)
	if (!dest) {
		while (src_idx--) {
		while (src_idx--)
			__free_page(xor_srcs[src_idx]);
			__free_page(xor_srcs[src_idx]);
		return -ENOMEM;
		return -ENOMEM;
	}
	}
+8 −8
Original line number Original line Diff line number Diff line
@@ -1019,16 +1019,16 @@ mv_xor_xor_self_test(struct mv_xor_device *device)


	for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
	for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
		xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
		xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
		if (!xor_srcs[src_idx])
		if (!xor_srcs[src_idx]) {
			while (src_idx--) {
			while (src_idx--)
				__free_page(xor_srcs[src_idx]);
				__free_page(xor_srcs[src_idx]);
			return -ENOMEM;
			return -ENOMEM;
		}
		}
	}
	}


	dest = alloc_page(GFP_KERNEL);
	dest = alloc_page(GFP_KERNEL);
	if (!dest)
	if (!dest) {
		while (src_idx--) {
		while (src_idx--)
			__free_page(xor_srcs[src_idx]);
			__free_page(xor_srcs[src_idx]);
		return -ENOMEM;
		return -ENOMEM;
	}
	}