Message ID | 20200901142535.12819-2-krzk@kernel.org |
---|---|
State | Accepted |
Headers | show |
Series | [1/6] mtd: onenand: Simplify with dev_err_probe() | expand |
On 01/09/2020 16:25:31+0200, Krzysztof Kozlowski wrote: > Common pattern of handling deferred probe can be simplified with > dev_err_probe(). Less code and the error value gets printed. > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com> > --- > drivers/mtd/nand/raw/atmel/nand-controller.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c > index c9818f548d07..71e2b83485d7 100644 > --- a/drivers/mtd/nand/raw/atmel/nand-controller.c > +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c > @@ -1976,13 +1976,9 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, > platform_set_drvdata(pdev, nc); > > nc->pmecc = devm_atmel_pmecc_get(dev); > - if (IS_ERR(nc->pmecc)) { > - ret = PTR_ERR(nc->pmecc); > - if (ret != -EPROBE_DEFER) > - dev_err(dev, "Could not get PMECC object (err = %d)\n", > - ret); > - return ret; > - } > + if (IS_ERR(nc->pmecc)) > + return dev_err_probe(dev, PTR_ERR(nc->pmecc), > + "Could not get PMECC object\n"); > > if (nc->caps->has_dma && !atmel_nand_avoid_dma) { > dma_cap_mask_t mask; > -- > 2.17.1 >
On Tue, 2020-09-01 at 14:25:31 UTC, Krzysztof Kozlowski wrote: > Common pattern of handling deferred probe can be simplified with > dev_err_probe(). Less code and the error value gets printed. > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> > Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index c9818f548d07..71e2b83485d7 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -1976,13 +1976,9 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, platform_set_drvdata(pdev, nc); nc->pmecc = devm_atmel_pmecc_get(dev); - if (IS_ERR(nc->pmecc)) { - ret = PTR_ERR(nc->pmecc); - if (ret != -EPROBE_DEFER) - dev_err(dev, "Could not get PMECC object (err = %d)\n", - ret); - return ret; - } + if (IS_ERR(nc->pmecc)) + return dev_err_probe(dev, PTR_ERR(nc->pmecc), + "Could not get PMECC object\n"); if (nc->caps->has_dma && !atmel_nand_avoid_dma) { dma_cap_mask_t mask;
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> --- drivers/mtd/nand/raw/atmel/nand-controller.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)