From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: Return error pointers from resource handling functions
Date: Fri, 12 Sep 2014 12:13:40 +0200 [thread overview]
Message-ID: <1410516830-9403-1-git-send-email-s.hauer@pengutronix.de> (raw)
Many many drivers do not check the return value of dev_request_mem_region(),
so in case of an error here the drivers usually crash with a NULL pointer
dereference later. This series adds the error checks to the drivers. While
at it, this series lets the resource functions return an ERR_PTR instead
of NULL to allow the users to just forward the error instead of inventing
an error code.
Sascha
----------------------------------------------------------------
Sascha Hauer (10):
ata: platform_ide: cleanup resource requesting
resource: Let dev_get_resource_by_name return an error pointer
resource: Let dev_get_mem_region_by_name return an error pointer
resource: Let __request_region return an error pointer
resource: Let request_iomem_region return an error pointer
resource: Let dev_get_resource return an error pointer
resource: Let dev_get_mem_region return an error pointer
resource: Let dev_request_mem_region_by_name return an error pointer
resource: Let dev_request_mem_region return an error pointer
resource: Let request_ioport_region return an error pointer
arch/arm/mach-at91/at91sam926x_time.c | 2 ++
arch/arm/mach-at91/sam9_smc.c | 5 +--
arch/arm/mach-imx/clk-imx1.c | 2 ++
arch/arm/mach-imx/clk-imx21.c | 2 ++
arch/arm/mach-imx/clk-imx25.c | 2 ++
arch/arm/mach-imx/clk-imx27.c | 2 ++
arch/arm/mach-imx/clk-imx31.c | 2 ++
arch/arm/mach-imx/clk-imx35.c | 2 ++
arch/arm/mach-imx/clk-imx5.c | 2 ++
arch/arm/mach-imx/clk-imx6.c | 2 ++
arch/arm/mach-imx/clocksource.c | 2 ++
arch/arm/mach-imx/esdctl.c | 5 +--
arch/arm/mach-imx/iim.c | 4 +--
arch/arm/mach-imx/ocotp.c | 4 +--
arch/arm/mach-mxs/ocotp.c | 3 ++
arch/arm/mach-tegra/tegra20-pmc.c | 5 +--
arch/arm/mach-tegra/tegra20-timer.c | 5 +--
arch/arm/mach-zynq/clk-zynq7000.c | 4 +--
arch/mips/mach-ar231x/ar231x_reset.c | 5 +--
common/memory.c | 7 ++--
common/resource.c | 15 +++++---
drivers/amba/bus.c | 5 +--
drivers/ata/ahci.c | 3 ++
drivers/ata/intf_platform_ide.c | 53 ++++++++++++++--------------
drivers/ata/pata-imx.c | 2 ++
drivers/ata/sata-imx.c | 4 +--
drivers/base/driver.c | 34 ++++++++++--------
drivers/bus/imx-weim.c | 5 +--
drivers/bus/omap-gpmc.c | 5 +--
drivers/clk/clk-ar933x.c | 4 +--
drivers/clk/mvebu/common.c | 5 +--
drivers/clk/mxs/clk-imx23.c | 2 ++
drivers/clk/mxs/clk-imx28.c | 2 ++
drivers/clk/socfpga.c | 4 +--
drivers/clk/tegra/clk-tegra124.c | 4 +--
drivers/clk/tegra/clk-tegra20.c | 4 +--
drivers/clk/tegra/clk-tegra30.c | 4 +--
drivers/clocksource/arm_smp_twd.c | 2 ++
drivers/clocksource/bcm2835.c | 2 ++
drivers/clocksource/clps711x.c | 4 +--
drivers/clocksource/digic.c | 5 +--
drivers/clocksource/mvebu.c | 2 ++
drivers/clocksource/nomadik.c | 2 ++
drivers/clocksource/orion.c | 3 ++
drivers/clocksource/uemd.c | 5 +--
drivers/dma/apbh_dma.c | 5 +--
drivers/gpio/gpio-clps711x.c | 10 ++++--
drivers/gpio/gpio-davinci.c | 4 +--
drivers/gpio/gpio-dw.c | 5 +--
drivers/gpio/gpio-generic.c | 11 +++---
drivers/gpio/gpio-jz4740.c | 5 +--
drivers/gpio/gpio-malta-fpga-i2c.c | 4 +--
drivers/gpio/gpio-omap.c | 4 +++
drivers/gpio/gpio-tegra.c | 4 +--
drivers/i2c/busses/i2c-imx.c | 3 ++
drivers/i2c/busses/i2c-omap.c | 2 ++
drivers/i2c/busses/i2c-versatile.c | 5 +--
drivers/input/imx_keypad.c | 3 ++
drivers/mci/atmel_mci.c | 2 ++
drivers/mci/dw_mmc.c | 4 +--
drivers/mci/imx-esdhc.c | 2 ++
drivers/mci/imx.c | 2 ++
drivers/mci/mci-bcm2835.c | 5 +--
drivers/mci/mxs.c | 2 ++
drivers/mci/omap_hsmmc.c | 3 ++
drivers/mci/pxamci.c | 3 ++
drivers/mci/s3c.c | 4 +++
drivers/mci/tegra-sdmmc.c | 5 +--
drivers/mfd/syscon.c | 8 ++---
drivers/misc/sram.c | 7 ++--
drivers/mtd/nand/atmel_nand.c | 3 ++
drivers/mtd/nand/nand_mxs.c | 5 +++
drivers/mtd/nand/nand_orion.c | 4 +--
drivers/mtd/nand/nomadik_nand.c | 7 ++++
drivers/mtd/nor/cfi_flash.c | 4 +++
drivers/net/altera_tse.c | 9 +++++
drivers/net/ar231x.c | 9 ++---
drivers/net/arc_emac.c | 3 ++
drivers/net/cpsw.c | 3 ++
drivers/net/designware.c | 4 +++
drivers/net/ethoc.c | 3 ++
drivers/net/fec_mpc5200.c | 3 ++
drivers/net/gianfar.c | 11 +++---
drivers/net/ks8851_mll.c | 6 ++++
drivers/net/macb.c | 2 ++
drivers/net/orion-gbe.c | 5 +++
drivers/net/phy/mdio-mvebu.c | 5 +--
drivers/net/smc91111.c | 3 ++
drivers/pinctrl/imx-iomux-v1.c | 3 ++
drivers/pinctrl/imx-iomux-v2.c | 3 ++
drivers/pinctrl/mvebu/armada-xp.c | 4 +--
drivers/pinctrl/mvebu/kirkwood.c | 5 +--
drivers/pinctrl/pinctrl-at91.c | 4 +--
drivers/pinctrl/pinctrl-rockchip.c | 4 +--
drivers/pinctrl/pinctrl-tegra20.c | 5 +--
drivers/pinctrl/pinctrl-tegra30.c | 5 +--
drivers/pwm/pwm-imx.c | 5 +--
drivers/serial/atmel.c | 3 ++
drivers/serial/serial_ar933x.c | 3 ++
drivers/serial/serial_auart.c | 2 ++
drivers/serial/serial_cadence.c | 4 +--
drivers/serial/serial_clps711x.c | 2 ++
drivers/serial/serial_mpc5xxx.c | 3 ++
drivers/serial/serial_ns16550.c | 14 ++++----
drivers/serial/stm-serial.c | 2 ++
drivers/spi/altera_spi.c | 3 ++
drivers/spi/mvebu_spi.c | 4 +--
drivers/spi/mxs_spi.c | 3 ++
drivers/usb/gadget/at91_udc.c | 4 +--
drivers/usb/gadget/fsl_udc.c | 4 +++
drivers/usb/host/ehci-hcd.c | 4 +++
drivers/usb/host/ohci-hcd.c | 3 ++
drivers/usb/imx/chipidea-imx.c | 5 +--
drivers/video/atmel_lcdfb_core.c | 2 ++
drivers/video/imx-ipu-fb.c | 2 ++
drivers/video/imx.c | 3 ++
drivers/video/omap.c | 3 +-
drivers/video/pxa.c | 3 ++
drivers/watchdog/im28wd.c | 3 ++
zz | 66 +++++++++++++++++++++++++++++++++++
120 files changed, 467 insertions(+), 164 deletions(-)
create mode 100644 zz
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2014-09-12 10:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-12 10:13 Sascha Hauer [this message]
2014-09-12 10:13 ` [PATCH 01/10] ata: platform_ide: cleanup resource requesting Sascha Hauer
2014-09-12 10:13 ` [PATCH 02/10] resource: Let dev_get_resource_by_name return an error pointer Sascha Hauer
2014-09-12 10:13 ` [PATCH 03/10] resource: Let dev_get_mem_region_by_name " Sascha Hauer
2014-09-12 10:13 ` [PATCH 04/10] resource: Let __request_region " Sascha Hauer
2014-09-12 10:13 ` [PATCH 05/10] resource: Let request_iomem_region " Sascha Hauer
2014-09-12 10:13 ` [PATCH 06/10] resource: Let dev_get_resource " Sascha Hauer
2014-09-12 10:13 ` [PATCH 07/10] resource: Let dev_get_mem_region " Sascha Hauer
2014-09-12 15:20 ` Sebastian Hesselbarth
2014-09-12 10:13 ` [PATCH 08/10] resource: Let dev_request_mem_region_by_name " Sascha Hauer
2014-09-12 10:13 ` [PATCH 09/10] resource: Let dev_request_mem_region " Sascha Hauer
2014-09-12 11:48 ` Baruch Siach
2014-09-15 5:21 ` Sascha Hauer
2014-09-12 10:13 ` [PATCH 10/10] resource: Let request_ioport_region " Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410516830-9403-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox