[lkml]   [2014]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2] mtd: orion_nand: fix error code path in probe
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 <>

Pushed to l2-mtd.git. Thanks!


 \ /
  Last update: 2014-10-22 11:21    [W:0.045 / U:1.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site