Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbaJRTg4 (ORCPT ); Sat, 18 Oct 2014 15:36:56 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:39925 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbaJRTgz (ORCPT ); Sat, 18 Oct 2014 15:36:55 -0400 Date: Sat, 18 Oct 2014 21:35:39 +0200 From: Andrew Lunn To: Michael Opdenacker Cc: andrew@lunn.ch, ezequiel.garcia@free-electrons.com, dwmw2@infradead.org, computersforpeace@gmail.com, jg1.han@samsung.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mtd: orion_nand: fix error code path in probe Message-ID: <20141018193539.GA20479@lunn.ch> References: <543F4CF0.8080404@free-electrons.com> <1413435515-12134-1-git-send-email-michael.opdenacker@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1413435515-12134-1-git-send-email-michael.opdenacker@free-electrons.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 16, 2014 at 06:58:35AM +0200, Michael Opdenacker wrote: > This replaces kzalloc() and ioremap() calls by devm_ functions > in the probe() routine, which automatically release the corresponding > resources when probe() fails or when the device is removed. > > This simplifies simplifies the error management code, and brings > the below improvements or changes: > > A. Fixing a bug reported by "make coccicheck": > > If "board = devm_kzalloc()" fails, the probe() function jumps > incorrectly to label "no_res" and therefore returns without > running iounmap(). > > B. Requesting the memory region > > Using devm_ioremap_resource() makes the probe() function request > the corresponding memory region before running ioremap(), as > it is supposed to do. > > C. Standardizing the error codes: > > The use of devm_ioremap_resource() changes the return value: > * -ENOMEM instead of -EIO in case of ioremap() failure, > * -EINVAL instead of -ENODEV in case of platform_get_resource() > failure. > > Signed-off-by: Michael Opdenacker Acked-by: Andrew Lunn I wanted to test it, but i don't have easy access to a device using nand. All mine are SPI based :-( Andrew -- 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/