Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbdGBNWe (ORCPT ); Sun, 2 Jul 2017 09:22:34 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39657 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818AbdGBNWd (ORCPT ); Sun, 2 Jul 2017 09:22:33 -0400 Date: Sun, 2 Jul 2017 15:22:28 +0200 (CEST) From: Thomas Gleixner To: Vikas Shivappa cc: x86@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, ravi.v.shankar@intel.com, vikas.shivappa@intel.com, tony.luck@intel.com, fenghua.yu@intel.com, andi.kleen@intel.com Subject: Re: [PATCH 16/21] x86/intel_rdt/cqm: Add mount,umount support In-Reply-To: <1498503368-20173-17-git-send-email-vikas.shivappa@linux.intel.com> Message-ID: References: <1498503368-20173-1-git-send-email-vikas.shivappa@linux.intel.com> <1498503368-20173-17-git-send-email-vikas.shivappa@linux.intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 504 Lines: 17 On Mon, 26 Jun 2017, Vikas Shivappa wrote: > > list_for_each_entry_safe(rdtgrp, tmp, &rdt_all_groups, rdtgroup_list) { > + /* Free any child rmids */ > + llist = &rdtgrp->crdtgrp_list; > + list_for_each_entry_safe(sentry, stmp, llist, crdtgrp_list) { > + free_rmid(sentry->rmid); > + list_del(&sentry->crdtgrp_list); > + kfree(sentry); > + } I'm pretty sure, that I've seen exactly this code sequence already. Please create a helper instead of copying stuff over and over. Thanks, tglx