Skip to content

Commit

Permalink
mtd: Remove dev_err() usage after platform_get_irq()
Browse files Browse the repository at this point in the history
We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.

// <smpl>
@@
expression ret;
struct platform_device *E;
@@

ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);

if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>

While we're here, remove braces on if statements that only have one
statement (manually).

Cc: David Woodhouse <[email protected]>
Cc: Brian Norris <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Miquel Raynal <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Vignesh Raghavendra <[email protected]>
Cc: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
  • Loading branch information
bebarino authored and miquelraynal committed Oct 8, 2019
1 parent 0990fc5 commit aab478c
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 37 deletions.
1 change: 0 additions & 1 deletion drivers/mtd/devices/spear_smi.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,6 @@ static int spear_smi_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
ret = -ENODEV;
dev_err(&pdev->dev, "invalid smi irq\n");
goto err;
}

Expand Down
4 changes: 1 addition & 3 deletions drivers/mtd/nand/raw/denali_dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,8 @@ static int denali_dt_probe(struct platform_device *pdev)

denali->dev = dev;
denali->irq = platform_get_irq(pdev, 0);
if (denali->irq < 0) {
dev_err(dev, "no irq defined\n");
if (denali->irq < 0)
return denali->irq;
}

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "denali_reg");
denali->reg = devm_ioremap_resource(dev, res);
Expand Down
4 changes: 1 addition & 3 deletions drivers/mtd/nand/raw/hisi504_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,8 @@ static int hisi_nfc_probe(struct platform_device *pdev)
mtd = nand_to_mtd(chip);

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "no IRQ resource defined\n");
if (irq < 0)
return -ENXIO;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->iobase = devm_ioremap_resource(dev, res);
Expand Down
1 change: 0 additions & 1 deletion drivers/mtd/nand/raw/lpc32xx_mlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)

host->irq = platform_get_irq(pdev, 0);
if (host->irq < 0) {
dev_err(&pdev->dev, "failed to get platform irq\n");
res = -EINVAL;
goto release_dma_chan;
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/mtd/nand/raw/marvell_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -2862,10 +2862,8 @@ static int marvell_nfc_probe(struct platform_device *pdev)
return PTR_ERR(nfc->regs);

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "failed to retrieve irq\n");
if (irq < 0)
return irq;
}

nfc->core_clk = devm_clk_get(&pdev->dev, "core");

Expand Down
4 changes: 1 addition & 3 deletions drivers/mtd/nand/raw/meson_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,10 +1399,8 @@ static int meson_nfc_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "no NFC IRQ resource\n");
if (irq < 0)
return -EINVAL;
}

ret = meson_nfc_clk_init(nfc);
if (ret) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/mtd/nand/raw/mtk_ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,8 @@ static int mtk_ecc_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "failed to get irq: %d\n", irq);
if (irq < 0)
return irq;
}

ret = dma_set_mask(dev, DMA_BIT_MASK(32));
if (ret) {
Expand Down
1 change: 0 additions & 1 deletion drivers/mtd/nand/raw/mtk_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "no nfi irq resource\n");
ret = -EINVAL;
goto clk_disable;
}
Expand Down
8 changes: 2 additions & 6 deletions drivers/mtd/nand/raw/omap2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,10 +1967,8 @@ static int omap_nand_attach_chip(struct nand_chip *chip)

case NAND_OMAP_PREFETCH_IRQ:
info->gpmc_irq_fifo = platform_get_irq(info->pdev, 0);
if (info->gpmc_irq_fifo <= 0) {
dev_err(dev, "Error getting fifo IRQ\n");
if (info->gpmc_irq_fifo <= 0)
return -ENODEV;
}
err = devm_request_irq(dev, info->gpmc_irq_fifo,
omap_nand_irq, IRQF_SHARED,
"gpmc-nand-fifo", info);
Expand All @@ -1982,10 +1980,8 @@ static int omap_nand_attach_chip(struct nand_chip *chip)
}

info->gpmc_irq_count = platform_get_irq(info->pdev, 1);
if (info->gpmc_irq_count <= 0) {
dev_err(dev, "Error getting IRQ count\n");
if (info->gpmc_irq_count <= 0)
return -ENODEV;
}
err = devm_request_irq(dev, info->gpmc_irq_count,
omap_nand_irq, IRQF_SHARED,
"gpmc-nand-count", info);
Expand Down
4 changes: 1 addition & 3 deletions drivers/mtd/nand/raw/sh_flctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1129,10 +1129,8 @@ static int flctl_probe(struct platform_device *pdev)
flctl->fifo = res->start + 0x24; /* FLDTFIFO */

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get flste irq data: %d\n", irq);
if (irq < 0)
return irq;
}

ret = devm_request_irq(&pdev->dev, irq, flctl_handle_flste, IRQF_SHARED,
"flste", flctl);
Expand Down
5 changes: 1 addition & 4 deletions drivers/mtd/nand/raw/stm32_fmc2_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1880,11 +1880,8 @@ static int stm32_fmc2_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
if (irq != -EPROBE_DEFER)
dev_err(dev, "IRQ error missing or invalid\n");
if (irq < 0)
return irq;
}

ret = devm_request_irq(dev, irq, stm32_fmc2_irq, 0,
dev_name(dev), fmc2);
Expand Down
4 changes: 1 addition & 3 deletions drivers/mtd/nand/raw/sunxi_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -2071,10 +2071,8 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
return PTR_ERR(nfc->regs);

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "failed to retrieve irq\n");
if (irq < 0)
return irq;
}

nfc->ahb_clk = devm_clk_get(dev, "ahb");
if (IS_ERR(nfc->ahb_clk)) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/mtd/spi-nor/cadence-quadspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,10 +1366,8 @@ static int cqspi_probe(struct platform_device *pdev)

/* Obtain IRQ line. */
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "Cannot obtain IRQ.\n");
if (irq < 0)
return -ENXIO;
}

pm_runtime_enable(dev);
ret = pm_runtime_get_sync(dev);
Expand Down

0 comments on commit aab478c

Please sign in to comment.