Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753627AbbDBOpF (ORCPT ); Thu, 2 Apr 2015 10:45:05 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]:36502 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752679AbbDBOpD (ORCPT ); Thu, 2 Apr 2015 10:45:03 -0400 MIME-Version: 1.0 In-Reply-To: <551D5352.8060305@nod.at> References: <1427984026-31100-1-git-send-email-richard@nod.at> <551D5352.8060305@nod.at> Date: Thu, 2 Apr 2015 11:45:00 -0300 Message-ID: Subject: Re: [PATCH] mtd: Add simple read disturb test From: Fabio Estevam To: Richard Weinberger Cc: Brian Norris , "linux-mtd@lists.infradead.org" , David Woodhouse , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 724 Lines: 17 On Thu, Apr 2, 2015 at 11:33 AM, Richard Weinberger wrote: > Why? Free()ing a NULL pointer is perfectly fine. > What did I miss? :) If the first 'iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);' fails then you jump to the out label where you call 5 kfree() and then return the error. It would be much better just to return the error immediately in this case and add one label for each allocation error, so that it only kfree the previous successful allocations. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/