From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751490AbdAPOGN (ORCPT ); Mon, 16 Jan 2017 09:06:13 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:40812 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751302AbdAPOGL (ORCPT ); Mon, 16 Jan 2017 09:06:11 -0500 Date: Mon, 16 Jan 2017 15:06:08 +0100 (CET) From: Thomas Gleixner To: Vikas Shivappa cc: vikas.shivappa@intel.com, linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, ravi.v.shankar@intel.com, tony.luck@intel.com, fenghua.yu@intel.com, h.peter.anvin@intel.com Subject: Re: [PATCH 5/8] x86/intel_rct/mba: Add MBA structures and initialize MBA In-Reply-To: <1484076788-25385-6-git-send-email-vikas.shivappa@linux.intel.com> Message-ID: References: <1484076788-25385-1-git-send-email-vikas.shivappa@linux.intel.com> <1484076788-25385-6-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 On Tue, 10 Jan 2017, Vikas Shivappa wrote: > +static void rdt_get_mem_config(struct rdt_resource *r) > +{ > + union cpuid_0x10_3_eax eax; > + union cpuid_0x10_x_edx edx; > + u32 ebx, ecx; > + > + cpuid_count(0x00000010, 3, &eax.full, &ebx, &ecx, &edx.full); > + r->num_closid = edx.split.cos_max + 1; > + r->max_delay = eax.split.max_delay + 1; > + r->no_ctrl = 0; > + if (ecx & MBE_IS_LINEAR) > + r->delay_linear = true; > + > + if (r->delay_linear) > + r->delay_gran = MAX_MBA_THRTL - r->max_delay; What's the point of this extra conditional? if (ecx & MBE_IS_LINEAR) { r->delay_linear = true; r->delay_gran = MAX_MBA_THRTL - r->max_delay; } would be too obvious and easy to understand, right? > +static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_domain *d) > +{ > + int i; > + > + d->ctrl_val = kmalloc_array(r->num_closid, > + sizeof(*d->ctrl_val), GFP_KERNEL); > + if (!d->ctrl_val) { > + kfree(d); Freeing memory in the error path of some other random function is just wrong. if (!d->ctrl_val) return -ENOMEM; and deal with the fallout at the calling function. Thanks, tglx