Re: [patch] perf/x86/intel/pt: cleanup error handling in pt_pmu_hw_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> There is no need to free NULL pointers.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_pt.c b/arch/x86/kernel/cpu/perf_event_intel_pt.c
> index f5a3afc..c358877 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_pt.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_pt.c
> @@ -135,12 +135,12 @@ static int __init pt_pmu_hw_init(void)
>  	size = sizeof(struct attribute *) * (ARRAY_SIZE(pt_caps) + 1);
>  	attrs = kzalloc(size, GFP_KERNEL);
>  	if (!attrs)
> -		goto err_attrs;
> +		return -ENOMEM;

Please don't put stray return statements into functions, try to keep 
to clean (and singular) goto driven exit paths.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux