From 104c7949e20e84dedddb66c1fc4b599931382d21 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Fri, 21 Sep 2012 14:26:37 +0800 Subject: [PATCH 1/6] ARM: OMAP: fix return value check in beagle_opp_init() In case of error, the function omap_device_get_by_hwmod_name() returns ERR_PTR() not NULL pointer. The NULL test in the return value check should be replaced with IS_ERR(). dpatch engine is used to auto generated this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun Signed-off-by: Kevin Hilman --- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 6202fc76e490..a548d7058c91 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -466,7 +466,7 @@ static void __init beagle_opp_init(void) mpu_dev = omap_device_get_by_hwmod_name("mpu"); iva_dev = omap_device_get_by_hwmod_name("iva"); - if (!mpu_dev || !iva_dev) { + if (IS_ERR(mpu_dev) || IS_ERR(iva_dev)) { pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", __func__, mpu_dev, iva_dev); return; From a87e662827bca4b10a320e62da3fb21826eab987 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Fri, 21 Sep 2012 14:32:04 +0800 Subject: [PATCH 2/6] ARM: OMAP: omap_device: fix return value check in omap_device_build_ss() In case of error, the function omap_device_alloc() returns ERR_PTR() and never returns NULL pointer. The NULL test in the return value check should be replaced with IS_ERR(). dpatch engine is used to auto generated this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun Signed-off-by: Kevin Hilman --- arch/arm/plat-omap/omap_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index c490240bb82c..3f62de67fa4a 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c @@ -671,7 +671,7 @@ struct platform_device __init *omap_device_build_ss(const char *pdev_name, int p dev_set_name(&pdev->dev, "%s", pdev->name); od = omap_device_alloc(pdev, ohs, oh_cnt, pm_lats, pm_lats_cnt); - if (!od) + if (IS_ERR(od)) goto odbs_exit1; ret = platform_device_add_data(pdev, pdata, pdata_len); From 07684c1b582ddd991c908f3de26e823b977d0a75 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 27 Sep 2012 13:54:22 +0800 Subject: [PATCH 3/6] ARM: OMAP2+: SmartReflex: fix return value check in sr_dev_init() In case of error, the function voltdm_lookup() returns NULL not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun Acked-by: Jean Pihet Signed-off-by: Kevin Hilman --- arch/arm/mach-omap2/sr_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index d033a65f4e4e..c248b309415b 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c @@ -123,7 +123,7 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) sr_data->senp_mod = 0x1; sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); - if (IS_ERR(sr_data->voltdm)) { + if (!sr_data->voltdm) { pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", __func__, sr_dev_attr->sensor_voltdm_name); goto exit; From 93b44bea0c17130e62d8b1b82c0e2a0d671230d1 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 27 Sep 2012 13:54:36 +0800 Subject: [PATCH 4/6] ARM: OMAP2+: PM: fix return value check in omap2_set_init_voltage() In case of error, the function voltdm_lookup() returns NULL not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun Acked-by: Jean Pihet Signed-off-by: Kevin Hilman --- arch/arm/mach-omap2/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 9cb5cede0f50..ab15e5c1bba5 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c @@ -176,7 +176,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, } voltdm = voltdm_lookup(vdd_name); - if (IS_ERR(voltdm)) { + if (!voltdm) { pr_err("%s: unable to get vdd pointer for vdd_%s\n", __func__, vdd_name); goto exit; From 70071ff989bae3edfc14847aaa8e1c3baa2aacff Mon Sep 17 00:00:00 2001 From: Jean Pihet Date: Thu, 20 Sep 2012 16:36:56 +0200 Subject: [PATCH 5/6] ARM: OMAP: SmartReflex: select CONFIG_POWER_SUPPLY in Kconfig Select POWER_SUPPLY from POWER_AVS_OMAP entry in Kconfig. This avoids the following build problems using a randconfig that has CONFIG_POWER_SUPPLY not set: LD init/built-in.o arch/arm/mach-omap2/built-in.o: In function `sr_class3_configure': arch/arm/mach-omap2/smartreflex-class3.c:44: undefined reference to `sr_configure_errgen' arch/arm/mach-omap2/built-in.o: In function `sr_class3_disable': arch/arm/mach-omap2/smartreflex-class3.c:33: undefined reference to `sr_disable_errgen' arch/arm/mach-omap2/smartreflex-class3.c:35: undefined reference to `sr_disable' arch/arm/mach-omap2/built-in.o: In function `sr_class3_enable': arch/arm/mach-omap2/smartreflex-class3.c:28: undefined reference to `sr_enable' arch/arm/mach-omap2/built-in.o: In function `sr_class3_init': arch/arm/mach-omap2/smartreflex-class3.c:59: undefined reference to `sr_register_class' make: *** [vmlinux] Error 1 Signed-off-by: Jean Pihet Signed-off-by: Kevin Hilman --- arch/arm/plat-omap/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index dd36eba9506c..001a795b6d6f 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -48,6 +48,7 @@ config OMAP_DEBUG_LEDS config POWER_AVS_OMAP bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2" depends on POWER_AVS && (ARCH_OMAP3 || ARCH_OMAP4) && PM + select POWER_SUPPLY help Say Y to enable AVS(Adaptive Voltage Scaling) support on OMAP containing the version 1 or From ce3810cdb4ca31238c87e095d2c494a5eaa4f65d Mon Sep 17 00:00:00 2001 From: Jean Pihet Date: Mon, 24 Sep 2012 16:16:40 +0200 Subject: [PATCH 6/6] ARM: OMAP: SmartReflex: fix error path in init function Fix the error handling path in omap_sr_probe to correctly de-allocate resources in case of problems. Signed-off-by: Jean Pihet Signed-off-by: Kevin Hilman --- drivers/power/avs/smartreflex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c index 44efc6e202af..92f67283c965 100644 --- a/drivers/power/avs/smartreflex.c +++ b/drivers/power/avs/smartreflex.c @@ -928,7 +928,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) if (!sr_info->base) { dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); ret = -ENOMEM; - goto err_release_region; + goto err_free_name; } if (irq) @@ -967,7 +967,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", __func__); ret = PTR_ERR(sr_info->dbg_dir); - goto err_free_name; + goto err_debugfs; } (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, @@ -1011,11 +1011,11 @@ static int __init omap_sr_probe(struct platform_device *pdev) err_debugfs: debugfs_remove_recursive(sr_info->dbg_dir); -err_free_name: - kfree(sr_info->name); err_iounmap: list_del(&sr_info->node); iounmap(sr_info->base); +err_free_name: + kfree(sr_info->name); err_release_region: release_mem_region(mem->start, resource_size(mem)); err_free_devinfo: