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

Commit 718d5851 authored by Robert Richter's avatar Robert Richter Committed by Borislav Petkov
Browse files

EDAC/mc: Cleanup _edac_mc_free() code



Remove needless and boilerplate variable declarations. No functional
changes.

 [ bp: Add newlines for better readability. ]

Signed-off-by: default avatarRobert Richter <rrichter@marvell.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20190624150758.6695-10-rrichter@marvell.com
parent 29a3388b
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -275,29 +275,28 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems)

static void _edac_mc_free(struct mem_ctl_info *mci)
{
	int i, chn, row;
	struct csrow_info *csr;
	const unsigned int tot_dimms = mci->tot_dimms;
	const unsigned int tot_channels = mci->num_cschannel;
	const unsigned int tot_csrows = mci->nr_csrows;
	int i, chn, row;

	if (mci->dimms) {
		for (i = 0; i < tot_dimms; i++)
		for (i = 0; i < mci->tot_dimms; i++)
			kfree(mci->dimms[i]);
		kfree(mci->dimms);
	}

	if (mci->csrows) {
		for (row = 0; row < tot_csrows; row++) {
		for (row = 0; row < mci->nr_csrows; row++) {
			csr = mci->csrows[row];
			if (csr) {
			if (!csr)
				continue;

			if (csr->channels) {
					for (chn = 0; chn < tot_channels; chn++)
				for (chn = 0; chn < mci->num_cschannel; chn++)
					kfree(csr->channels[chn]);
				kfree(csr->channels);
			}
			kfree(csr);
		}
		}
		kfree(mci->csrows);
	}
	kfree(mci);