aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/i2c.c2
-rw-r--r--arch/m68k/amiga/platform.c2
-rw-r--r--arch/m68k/kernel/time.c2
-rw-r--r--arch/m68k/q40/config.c2
-rw-r--r--arch/powerpc/kernel/iommu.c2
-rw-r--r--arch/powerpc/kernel/time.c2
-rw-r--r--arch/powerpc/platforms/ps3/time.c2
-rw-r--r--arch/powerpc/sysdev/rtc_cmos_setup.c2
-rw-r--r--arch/s390/hypfs/hypfs_dbfs.c2
-rw-r--r--drivers/char/tile-srom.c2
-rw-r--r--drivers/infiniband/core/cma.c2
-rw-r--r--drivers/net/appletalk/cops.c2
-rw-r--r--drivers/net/appletalk/ltpc.c2
-rw-r--r--drivers/net/ethernet/amd/atarilance.c2
-rw-r--r--drivers/net/ethernet/amd/mvme147.c2
-rw-r--r--drivers/net/ethernet/amd/ni65.c2
-rw-r--r--drivers/net/ethernet/amd/sun3lance.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/debug.c2
-rw-r--r--drivers/platform/x86/samsung-q10.c2
-rw-r--r--drivers/regulator/fan53555.c2
-rw-r--r--drivers/spi/spi-fsl-spi.c2
-rw-r--r--drivers/spi/spidev.c2
-rw-r--r--drivers/video/omap2/dss/core.c2
-rw-r--r--fs/btrfs/dev-replace.c2
-rw-r--r--fs/btrfs/inode.c2
-rw-r--r--net/bluetooth/hci_sysfs.c2
-rw-r--r--net/bridge/netfilter/ebtable_broute.c2
-rw-r--r--net/bridge/netfilter/ebtable_filter.c2
-rw-r--r--net/bridge/netfilter/ebtable_nat.c2
-rw-r--r--net/ipv4/netfilter/arptable_filter.c2
-rw-r--r--net/ipv4/netfilter/iptable_filter.c2
-rw-r--r--net/ipv4/netfilter/iptable_mangle.c2
-rw-r--r--net/ipv4/netfilter/iptable_nat.c2
-rw-r--r--net/ipv4/netfilter/iptable_raw.c2
-rw-r--r--net/ipv4/netfilter/iptable_security.c2
-rw-r--r--net/ipv6/netfilter/ip6table_filter.c2
-rw-r--r--net/ipv6/netfilter/ip6table_mangle.c2
-rw-r--r--net/ipv6/netfilter/ip6table_nat.c2
-rw-r--r--net/ipv6/netfilter/ip6table_raw.c2
-rw-r--r--net/ipv6/netfilter/ip6table_security.c2
-rw-r--r--scripts/coccinelle/api/ptr_ret.cocci10
-rw-r--r--sound/soc/soc-io.c2
43 files changed, 47 insertions, 47 deletions
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index d940e53dd9f2..b456b4471f35 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -181,7 +181,7 @@ int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
181 sizeof(struct omap_i2c_bus_platform_data)); 181 sizeof(struct omap_i2c_bus_platform_data));
182 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name); 182 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
183 183
184 return PTR_RET(pdev); 184 return PTR_ERR_OR_ZERO(pdev);
185} 185}
186 186
187static int __init omap_i2c_cmdline(void) 187static int __init omap_i2c_cmdline(void)
diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c
index 6083088c0cca..dacd9f911f71 100644
--- a/arch/m68k/amiga/platform.c
+++ b/arch/m68k/amiga/platform.c
@@ -56,7 +56,7 @@ static int __init amiga_init_bus(void)
56 n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2; 56 n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
57 pdev = platform_device_register_simple("amiga-zorro", -1, 57 pdev = platform_device_register_simple("amiga-zorro", -1,
58 zorro_resources, n); 58 zorro_resources, n);
59 return PTR_RET(pdev); 59 return PTR_ERR_OR_ZERO(pdev);
60} 60}
61 61
62subsys_initcall(amiga_init_bus); 62subsys_initcall(amiga_init_bus);
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index bea6bcf8f9b8..7eb9792009f8 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -90,7 +90,7 @@ static int __init rtc_init(void)
90 return -ENODEV; 90 return -ENODEV;
91 91
92 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); 92 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
93 return PTR_RET(pdev); 93 return PTR_ERR_OR_ZERO(pdev);
94} 94}
95 95
96module_init(rtc_init); 96module_init(rtc_init);
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 658542b914fc..078bb744b5fe 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -338,6 +338,6 @@ static __init int q40_add_kbd_device(void)
338 return -ENODEV; 338 return -ENODEV;
339 339
340 pdev = platform_device_register_simple("q40kbd", -1, NULL, 0); 340 pdev = platform_device_register_simple("q40kbd", -1, NULL, 0);
341 return PTR_RET(pdev); 341 return PTR_ERR_OR_ZERO(pdev);
342} 342}
343arch_initcall(q40_add_kbd_device); 343arch_initcall(q40_add_kbd_device);
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index b20ff173a671..0adab06ce5c0 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -105,7 +105,7 @@ static int __init fail_iommu_debugfs(void)
105 struct dentry *dir = fault_create_debugfs_attr("fail_iommu", 105 struct dentry *dir = fault_create_debugfs_attr("fail_iommu",
106 NULL, &fail_iommu); 106 NULL, &fail_iommu);
107 107
108 return PTR_RET(dir); 108 return PTR_ERR_OR_ZERO(dir);
109} 109}
110late_initcall(fail_iommu_debugfs); 110late_initcall(fail_iommu_debugfs);
111 111
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 65ab9e909377..cdcc156865ef 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1049,7 +1049,7 @@ static int __init rtc_init(void)
1049 1049
1050 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); 1050 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
1051 1051
1052 return PTR_RET(pdev); 1052 return PTR_ERR_OR_ZERO(pdev);
1053} 1053}
1054 1054
1055module_init(rtc_init); 1055module_init(rtc_init);
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index cba1e6be68e5..ce73ce865613 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -90,7 +90,7 @@ static int __init ps3_rtc_init(void)
90 90
91 pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0); 91 pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
92 92
93 return PTR_RET(pdev); 93 return PTR_ERR_OR_ZERO(pdev);
94} 94}
95 95
96module_init(ps3_rtc_init); 96module_init(ps3_rtc_init);
diff --git a/arch/powerpc/sysdev/rtc_cmos_setup.c b/arch/powerpc/sysdev/rtc_cmos_setup.c
index af79e1ea74b6..af0f9beddca9 100644
--- a/arch/powerpc/sysdev/rtc_cmos_setup.c
+++ b/arch/powerpc/sysdev/rtc_cmos_setup.c
@@ -62,7 +62,7 @@ static int __init add_rtc(void)
62 pd = platform_device_register_simple("rtc_cmos", -1, 62 pd = platform_device_register_simple("rtc_cmos", -1,
63 &res[0], num_res); 63 &res[0], num_res);
64 64
65 return PTR_RET(pd); 65 return PTR_ERR_OR_ZERO(pd);
66} 66}
67fs_initcall(add_rtc); 67fs_initcall(add_rtc);
68 68
diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c
index bb5dd496614f..17ab8b7b53cc 100644
--- a/arch/s390/hypfs/hypfs_dbfs.c
+++ b/arch/s390/hypfs/hypfs_dbfs.c
@@ -105,7 +105,7 @@ void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df)
105int hypfs_dbfs_init(void) 105int hypfs_dbfs_init(void)
106{ 106{
107 dbfs_dir = debugfs_create_dir("s390_hypfs", NULL); 107 dbfs_dir = debugfs_create_dir("s390_hypfs", NULL);
108 return PTR_RET(dbfs_dir); 108 return PTR_ERR_OR_ZERO(dbfs_dir);
109} 109}
110 110
111void hypfs_dbfs_exit(void) 111void hypfs_dbfs_exit(void)
diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c
index 7faeb1cde97d..ce04d6eb23d4 100644
--- a/drivers/char/tile-srom.c
+++ b/drivers/char/tile-srom.c
@@ -349,7 +349,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index)
349 349
350 dev = device_create(srom_class, &platform_bus, 350 dev = device_create(srom_class, &platform_bus,
351 MKDEV(srom_major, index), srom, "%d", index); 351 MKDEV(srom_major, index), srom, "%d", index);
352 return PTR_RET(dev); 352 return PTR_ERR_OR_ZERO(dev);
353} 353}
354 354
355/** srom_init() - Initialize the driver's module. */ 355/** srom_init() - Initialize the driver's module. */
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index f1c279fabe64..4df360bede81 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -3205,7 +3205,7 @@ static int cma_join_ib_multicast(struct rdma_id_private *id_priv,
3205 id_priv->id.port_num, &rec, 3205 id_priv->id.port_num, &rec,
3206 comp_mask, GFP_KERNEL, 3206 comp_mask, GFP_KERNEL,
3207 cma_ib_mc_handler, mc); 3207 cma_ib_mc_handler, mc);
3208 return PTR_RET(mc->multicast.ib); 3208 return PTR_ERR_OR_ZERO(mc->multicast.ib);
3209} 3209}
3210 3210
3211static void iboe_mcast_work_handler(struct work_struct *work) 3211static void iboe_mcast_work_handler(struct work_struct *work)
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index cff6f023c03a..7f2a032c354c 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -996,7 +996,7 @@ static int __init cops_module_init(void)
996 printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n", 996 printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n",
997 cardname); 997 cardname);
998 cops_dev = cops_probe(-1); 998 cops_dev = cops_probe(-1);
999 return PTR_RET(cops_dev); 999 return PTR_ERR_OR_ZERO(cops_dev);
1000} 1000}
1001 1001
1002static void __exit cops_module_exit(void) 1002static void __exit cops_module_exit(void)
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index b5782cdf0bca..01e2ac55c137 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1243,7 +1243,7 @@ static int __init ltpc_module_init(void)
1243 "ltpc: Autoprobing is not recommended for modules\n"); 1243 "ltpc: Autoprobing is not recommended for modules\n");
1244 1244
1245 dev_ltpc = ltpc_probe(); 1245 dev_ltpc = ltpc_probe();
1246 return PTR_RET(dev_ltpc); 1246 return PTR_ERR_OR_ZERO(dev_ltpc);
1247} 1247}
1248module_init(ltpc_module_init); 1248module_init(ltpc_module_init);
1249#endif 1249#endif
diff --git a/drivers/net/ethernet/amd/atarilance.c b/drivers/net/ethernet/amd/atarilance.c
index e8d0ef508f48..10ceca523fc0 100644
--- a/drivers/net/ethernet/amd/atarilance.c
+++ b/drivers/net/ethernet/amd/atarilance.c
@@ -1147,7 +1147,7 @@ static struct net_device *atarilance_dev;
1147static int __init atarilance_module_init(void) 1147static int __init atarilance_module_init(void)
1148{ 1148{
1149 atarilance_dev = atarilance_probe(-1); 1149 atarilance_dev = atarilance_probe(-1);
1150 return PTR_RET(atarilance_dev); 1150 return PTR_ERR_OR_ZERO(atarilance_dev);
1151} 1151}
1152 1152
1153static void __exit atarilance_module_exit(void) 1153static void __exit atarilance_module_exit(void)
diff --git a/drivers/net/ethernet/amd/mvme147.c b/drivers/net/ethernet/amd/mvme147.c
index a51497c9d2af..e108e911da05 100644
--- a/drivers/net/ethernet/amd/mvme147.c
+++ b/drivers/net/ethernet/amd/mvme147.c
@@ -188,7 +188,7 @@ static struct net_device *dev_mvme147_lance;
188int __init init_module(void) 188int __init init_module(void)
189{ 189{
190 dev_mvme147_lance = mvme147lance_probe(-1); 190 dev_mvme147_lance = mvme147lance_probe(-1);
191 return PTR_RET(dev_mvme147_lance); 191 return PTR_ERR_OR_ZERO(dev_mvme147_lance);
192} 192}
193 193
194void __exit cleanup_module(void) 194void __exit cleanup_module(void)
diff --git a/drivers/net/ethernet/amd/ni65.c b/drivers/net/ethernet/amd/ni65.c
index 26fc0ce0faa3..1cf33addd15e 100644
--- a/drivers/net/ethernet/amd/ni65.c
+++ b/drivers/net/ethernet/amd/ni65.c
@@ -1238,7 +1238,7 @@ MODULE_PARM_DESC(dma, "ni6510 ISA DMA channel (ignored for some cards)");
1238int __init init_module(void) 1238int __init init_module(void)
1239{ 1239{
1240 dev_ni65 = ni65_probe(-1); 1240 dev_ni65 = ni65_probe(-1);
1241 return PTR_RET(dev_ni65); 1241 return PTR_ERR_OR_ZERO(dev_ni65);
1242} 1242}
1243 1243
1244void __exit cleanup_module(void) 1244void __exit cleanup_module(void)
diff --git a/drivers/net/ethernet/amd/sun3lance.c b/drivers/net/ethernet/amd/sun3lance.c
index 4375abe61da1..d6b20296b8e4 100644
--- a/drivers/net/ethernet/amd/sun3lance.c
+++ b/drivers/net/ethernet/amd/sun3lance.c
@@ -940,7 +940,7 @@ static struct net_device *sun3lance_dev;
940int __init init_module(void) 940int __init init_module(void)
941{ 941{
942 sun3lance_dev = sun3lance_probe(-1); 942 sun3lance_dev = sun3lance_probe(-1);
943 return PTR_RET(sun3lance_dev); 943 return PTR_ERR_OR_ZERO(sun3lance_dev);
944} 944}
945 945
946void __exit cleanup_module(void) 946void __exit cleanup_module(void)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
index c37b9d68e458..0f9e9057e7dd 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
@@ -50,7 +50,7 @@ int brcmf_debugfs_attach(struct brcmf_pub *drvr)
50 return -ENODEV; 50 return -ENODEV;
51 51
52 drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder); 52 drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
53 return PTR_RET(drvr->dbgfs_dir); 53 return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
54} 54}
55 55
56void brcmf_debugfs_detach(struct brcmf_pub *drvr) 56void brcmf_debugfs_detach(struct brcmf_pub *drvr)
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.c b/drivers/net/wireless/brcm80211/brcmsmac/debug.c
index 9761deb46204..a5d4add26f41 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/debug.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/debug.c
@@ -56,7 +56,7 @@ int brcms_debugfs_attach(struct brcms_pub *drvr)
56 56
57 drvr->dbgfs_dir = debugfs_create_dir( 57 drvr->dbgfs_dir = debugfs_create_dir(
58 dev_name(&drvr->wlc->hw->d11core->dev), root_folder); 58 dev_name(&drvr->wlc->hw->d11core->dev), root_folder);
59 return PTR_RET(drvr->dbgfs_dir); 59 return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
60} 60}
61 61
62void brcms_debugfs_detach(struct brcms_pub *drvr) 62void brcms_debugfs_detach(struct brcms_pub *drvr)
diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c
index 1a90b62a71c6..4430b8c1369d 100644
--- a/drivers/platform/x86/samsung-q10.c
+++ b/drivers/platform/x86/samsung-q10.c
@@ -176,7 +176,7 @@ static int __init samsungq10_init(void)
176 samsungq10_probe, 176 samsungq10_probe,
177 NULL, 0, NULL, 0); 177 NULL, 0, NULL, 0);
178 178
179 return PTR_RET(samsungq10_device); 179 return PTR_ERR_OR_ZERO(samsungq10_device);
180} 180}
181 181
182static void __exit samsungq10_exit(void) 182static void __exit samsungq10_exit(void)
diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index f0e1ae52bb05..192444a8dab0 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -219,7 +219,7 @@ static int fan53555_regulator_register(struct fan53555_device_info *di,
219 rdesc->owner = THIS_MODULE; 219 rdesc->owner = THIS_MODULE;
220 220
221 di->rdev = regulator_register(&di->desc, config); 221 di->rdev = regulator_register(&di->desc, config);
222 return PTR_RET(di->rdev); 222 return PTR_ERR_OR_ZERO(di->rdev);
223 223
224} 224}
225 225
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 41e89c3e3edc..ca0ddb8cef5c 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -901,7 +901,7 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev)
901 return -EINVAL; 901 return -EINVAL;
902 902
903 master = fsl_spi_probe(&pdev->dev, mem, irq); 903 master = fsl_spi_probe(&pdev->dev, mem, irq);
904 return PTR_RET(master); 904 return PTR_ERR_OR_ZERO(master);
905} 905}
906 906
907static int plat_mpc8xxx_spi_remove(struct platform_device *pdev) 907static int plat_mpc8xxx_spi_remove(struct platform_device *pdev)
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 911e9e0711d2..ca5bcfe874d0 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -603,7 +603,7 @@ static int spidev_probe(struct spi_device *spi)
603 dev = device_create(spidev_class, &spi->dev, spidev->devt, 603 dev = device_create(spidev_class, &spi->dev, spidev->devt,
604 spidev, "spidev%d.%d", 604 spidev, "spidev%d.%d",
605 spi->master->bus_num, spi->chip_select); 605 spi->master->bus_num, spi->chip_select);
606 status = PTR_RET(dev); 606 status = PTR_ERR_OR_ZERO(dev);
607 } else { 607 } else {
608 dev_dbg(&spi->dev, "no minor number available!\n"); 608 dev_dbg(&spi->dev, "no minor number available!\n");
609 status = -ENODEV; 609 status = -ENODEV;
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 1aeb274e30fc..a7ce26c090dd 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -189,7 +189,7 @@ int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
189 d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, 189 d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
190 write, &dss_debug_fops); 190 write, &dss_debug_fops);
191 191
192 return PTR_RET(d); 192 return PTR_ERR_OR_ZERO(d);
193} 193}
194#else /* CONFIG_OMAP2_DSS_DEBUGFS */ 194#else /* CONFIG_OMAP2_DSS_DEBUGFS */
195static inline int dss_initialize_debugfs(void) 195static inline int dss_initialize_debugfs(void)
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 4253ad580e39..5f8f3341c099 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -747,7 +747,7 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info *fs_info)
747 WARN_ON(atomic_xchg( 747 WARN_ON(atomic_xchg(
748 &fs_info->mutually_exclusive_operation_running, 1)); 748 &fs_info->mutually_exclusive_operation_running, 1));
749 task = kthread_run(btrfs_dev_replace_kthread, fs_info, "btrfs-devrepl"); 749 task = kthread_run(btrfs_dev_replace_kthread, fs_info, "btrfs-devrepl");
750 return PTR_RET(task); 750 return PTR_ERR_OR_ZERO(task);
751} 751}
752 752
753static int btrfs_dev_replace_kthread(void *data) 753static int btrfs_dev_replace_kthread(void *data)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6d1b93c8aafb..2987e1755d60 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3166,7 +3166,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
3166 found_key.type = BTRFS_INODE_ITEM_KEY; 3166 found_key.type = BTRFS_INODE_ITEM_KEY;
3167 found_key.offset = 0; 3167 found_key.offset = 0;
3168 inode = btrfs_iget(root->fs_info->sb, &found_key, root, NULL); 3168 inode = btrfs_iget(root->fs_info->sb, &found_key, root, NULL);
3169 ret = PTR_RET(inode); 3169 ret = PTR_ERR_OR_ZERO(inode);
3170 if (ret && ret != -ESTALE) 3170 if (ret && ret != -ESTALE)
3171 goto out; 3171 goto out;
3172 3172
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 7ad6ecf36f20..edf623a29043 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -590,7 +590,7 @@ int __init bt_sysfs_init(void)
590 590
591 bt_class = class_create(THIS_MODULE, "bluetooth"); 591 bt_class = class_create(THIS_MODULE, "bluetooth");
592 592
593 return PTR_RET(bt_class); 593 return PTR_ERR_OR_ZERO(bt_class);
594} 594}
595 595
596void bt_sysfs_cleanup(void) 596void bt_sysfs_cleanup(void)
diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c
index 70f656ce0f4a..dbd1c783431b 100644
--- a/net/bridge/netfilter/ebtable_broute.c
+++ b/net/bridge/netfilter/ebtable_broute.c
@@ -64,7 +64,7 @@ static int ebt_broute(struct sk_buff *skb)
64static int __net_init broute_net_init(struct net *net) 64static int __net_init broute_net_init(struct net *net)
65{ 65{
66 net->xt.broute_table = ebt_register_table(net, &broute_table); 66 net->xt.broute_table = ebt_register_table(net, &broute_table);
67 return PTR_RET(net->xt.broute_table); 67 return PTR_ERR_OR_ZERO(net->xt.broute_table);
68} 68}
69 69
70static void __net_exit broute_net_exit(struct net *net) 70static void __net_exit broute_net_exit(struct net *net)
diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c
index 3c2e9dced9e0..94b2b700cff8 100644
--- a/net/bridge/netfilter/ebtable_filter.c
+++ b/net/bridge/netfilter/ebtable_filter.c
@@ -100,7 +100,7 @@ static struct nf_hook_ops ebt_ops_filter[] __read_mostly = {
100static int __net_init frame_filter_net_init(struct net *net) 100static int __net_init frame_filter_net_init(struct net *net)
101{ 101{
102 net->xt.frame_filter = ebt_register_table(net, &frame_filter); 102 net->xt.frame_filter = ebt_register_table(net, &frame_filter);
103 return PTR_RET(net->xt.frame_filter); 103 return PTR_ERR_OR_ZERO(net->xt.frame_filter);
104} 104}
105 105
106static void __net_exit frame_filter_net_exit(struct net *net) 106static void __net_exit frame_filter_net_exit(struct net *net)
diff --git a/net/bridge/netfilter/ebtable_nat.c b/net/bridge/netfilter/ebtable_nat.c
index 10871bc77908..322555acdd40 100644
--- a/net/bridge/netfilter/ebtable_nat.c
+++ b/net/bridge/netfilter/ebtable_nat.c
@@ -100,7 +100,7 @@ static struct nf_hook_ops ebt_ops_nat[] __read_mostly = {
100static int __net_init frame_nat_net_init(struct net *net) 100static int __net_init frame_nat_net_init(struct net *net)
101{ 101{
102 net->xt.frame_nat = ebt_register_table(net, &frame_nat); 102 net->xt.frame_nat = ebt_register_table(net, &frame_nat);
103 return PTR_RET(net->xt.frame_nat); 103 return PTR_ERR_OR_ZERO(net->xt.frame_nat);
104} 104}
105 105
106static void __net_exit frame_nat_net_exit(struct net *net) 106static void __net_exit frame_nat_net_exit(struct net *net)
diff --git a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c
index eadab1ed6500..a865f6f94013 100644
--- a/net/ipv4/netfilter/arptable_filter.c
+++ b/net/ipv4/netfilter/arptable_filter.c
@@ -48,7 +48,7 @@ static int __net_init arptable_filter_net_init(struct net *net)
48 net->ipv4.arptable_filter = 48 net->ipv4.arptable_filter =
49 arpt_register_table(net, &packet_filter, repl); 49 arpt_register_table(net, &packet_filter, repl);
50 kfree(repl); 50 kfree(repl);
51 return PTR_RET(net->ipv4.arptable_filter); 51 return PTR_ERR_OR_ZERO(net->ipv4.arptable_filter);
52} 52}
53 53
54static void __net_exit arptable_filter_net_exit(struct net *net) 54static void __net_exit arptable_filter_net_exit(struct net *net)
diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
index 6b3da5cf54e9..50af5b45c050 100644
--- a/net/ipv4/netfilter/iptable_filter.c
+++ b/net/ipv4/netfilter/iptable_filter.c
@@ -69,7 +69,7 @@ static int __net_init iptable_filter_net_init(struct net *net)
69 net->ipv4.iptable_filter = 69 net->ipv4.iptable_filter =
70 ipt_register_table(net, &packet_filter, repl); 70 ipt_register_table(net, &packet_filter, repl);
71 kfree(repl); 71 kfree(repl);
72 return PTR_RET(net->ipv4.iptable_filter); 72 return PTR_ERR_OR_ZERO(net->ipv4.iptable_filter);
73} 73}
74 74
75static void __net_exit iptable_filter_net_exit(struct net *net) 75static void __net_exit iptable_filter_net_exit(struct net *net)
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
index cba5658ec82c..0d8cd82e0fad 100644
--- a/net/ipv4/netfilter/iptable_mangle.c
+++ b/net/ipv4/netfilter/iptable_mangle.c
@@ -107,7 +107,7 @@ static int __net_init iptable_mangle_net_init(struct net *net)
107 net->ipv4.iptable_mangle = 107 net->ipv4.iptable_mangle =
108 ipt_register_table(net, &packet_mangler, repl); 108 ipt_register_table(net, &packet_mangler, repl);
109 kfree(repl); 109 kfree(repl);
110 return PTR_RET(net->ipv4.iptable_mangle); 110 return PTR_ERR_OR_ZERO(net->ipv4.iptable_mangle);
111} 111}
112 112
113static void __net_exit iptable_mangle_net_exit(struct net *net) 113static void __net_exit iptable_mangle_net_exit(struct net *net)
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c
index 6383273d54e1..683bfaffed65 100644
--- a/net/ipv4/netfilter/iptable_nat.c
+++ b/net/ipv4/netfilter/iptable_nat.c
@@ -292,7 +292,7 @@ static int __net_init iptable_nat_net_init(struct net *net)
292 return -ENOMEM; 292 return -ENOMEM;
293 net->ipv4.nat_table = ipt_register_table(net, &nf_nat_ipv4_table, repl); 293 net->ipv4.nat_table = ipt_register_table(net, &nf_nat_ipv4_table, repl);
294 kfree(repl); 294 kfree(repl);
295 return PTR_RET(net->ipv4.nat_table); 295 return PTR_ERR_OR_ZERO(net->ipv4.nat_table);
296} 296}
297 297
298static void __net_exit iptable_nat_net_exit(struct net *net) 298static void __net_exit iptable_nat_net_exit(struct net *net)
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c
index 03d9696d3c6e..1f82aea11df6 100644
--- a/net/ipv4/netfilter/iptable_raw.c
+++ b/net/ipv4/netfilter/iptable_raw.c
@@ -48,7 +48,7 @@ static int __net_init iptable_raw_net_init(struct net *net)
48 net->ipv4.iptable_raw = 48 net->ipv4.iptable_raw =
49 ipt_register_table(net, &packet_raw, repl); 49 ipt_register_table(net, &packet_raw, repl);
50 kfree(repl); 50 kfree(repl);
51 return PTR_RET(net->ipv4.iptable_raw); 51 return PTR_ERR_OR_ZERO(net->ipv4.iptable_raw);
52} 52}
53 53
54static void __net_exit iptable_raw_net_exit(struct net *net) 54static void __net_exit iptable_raw_net_exit(struct net *net)
diff --git a/net/ipv4/netfilter/iptable_security.c b/net/ipv4/netfilter/iptable_security.c
index b283d8e2601a..f867a8d38bf7 100644
--- a/net/ipv4/netfilter/iptable_security.c
+++ b/net/ipv4/netfilter/iptable_security.c
@@ -66,7 +66,7 @@ static int __net_init iptable_security_net_init(struct net *net)
66 net->ipv4.iptable_security = 66 net->ipv4.iptable_security =
67 ipt_register_table(net, &security_table, repl); 67 ipt_register_table(net, &security_table, repl);
68 kfree(repl); 68 kfree(repl);
69 return PTR_RET(net->ipv4.iptable_security); 69 return PTR_ERR_OR_ZERO(net->ipv4.iptable_security);
70} 70}
71 71
72static void __net_exit iptable_security_net_exit(struct net *net) 72static void __net_exit iptable_security_net_exit(struct net *net)
diff --git a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c
index beb5777d2043..29b44b14c5ea 100644
--- a/net/ipv6/netfilter/ip6table_filter.c
+++ b/net/ipv6/netfilter/ip6table_filter.c
@@ -61,7 +61,7 @@ static int __net_init ip6table_filter_net_init(struct net *net)
61 net->ipv6.ip6table_filter = 61 net->ipv6.ip6table_filter =
62 ip6t_register_table(net, &packet_filter, repl); 62 ip6t_register_table(net, &packet_filter, repl);
63 kfree(repl); 63 kfree(repl);
64 return PTR_RET(net->ipv6.ip6table_filter); 64 return PTR_ERR_OR_ZERO(net->ipv6.ip6table_filter);
65} 65}
66 66
67static void __net_exit ip6table_filter_net_exit(struct net *net) 67static void __net_exit ip6table_filter_net_exit(struct net *net)
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index e075399d8b72..c705907ae6ab 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -101,7 +101,7 @@ static int __net_init ip6table_mangle_net_init(struct net *net)
101 net->ipv6.ip6table_mangle = 101 net->ipv6.ip6table_mangle =
102 ip6t_register_table(net, &packet_mangler, repl); 102 ip6t_register_table(net, &packet_mangler, repl);
103 kfree(repl); 103 kfree(repl);
104 return PTR_RET(net->ipv6.ip6table_mangle); 104 return PTR_ERR_OR_ZERO(net->ipv6.ip6table_mangle);
105} 105}
106 106
107static void __net_exit ip6table_mangle_net_exit(struct net *net) 107static void __net_exit ip6table_mangle_net_exit(struct net *net)
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c
index 6383f90efda8..9b076d2d3a7b 100644
--- a/net/ipv6/netfilter/ip6table_nat.c
+++ b/net/ipv6/netfilter/ip6table_nat.c
@@ -293,7 +293,7 @@ static int __net_init ip6table_nat_net_init(struct net *net)
293 return -ENOMEM; 293 return -ENOMEM;
294 net->ipv6.ip6table_nat = ip6t_register_table(net, &nf_nat_ipv6_table, repl); 294 net->ipv6.ip6table_nat = ip6t_register_table(net, &nf_nat_ipv6_table, repl);
295 kfree(repl); 295 kfree(repl);
296 return PTR_RET(net->ipv6.ip6table_nat); 296 return PTR_ERR_OR_ZERO(net->ipv6.ip6table_nat);
297} 297}
298 298
299static void __net_exit ip6table_nat_net_exit(struct net *net) 299static void __net_exit ip6table_nat_net_exit(struct net *net)
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c
index 60d1bddff7a0..9a626d86720f 100644
--- a/net/ipv6/netfilter/ip6table_raw.c
+++ b/net/ipv6/netfilter/ip6table_raw.c
@@ -40,7 +40,7 @@ static int __net_init ip6table_raw_net_init(struct net *net)
40 net->ipv6.ip6table_raw = 40 net->ipv6.ip6table_raw =
41 ip6t_register_table(net, &packet_raw, repl); 41 ip6t_register_table(net, &packet_raw, repl);
42 kfree(repl); 42 kfree(repl);
43 return PTR_RET(net->ipv6.ip6table_raw); 43 return PTR_ERR_OR_ZERO(net->ipv6.ip6table_raw);
44} 44}
45 45
46static void __net_exit ip6table_raw_net_exit(struct net *net) 46static void __net_exit ip6table_raw_net_exit(struct net *net)
diff --git a/net/ipv6/netfilter/ip6table_security.c b/net/ipv6/netfilter/ip6table_security.c
index db155351339c..ce88d1d7e525 100644
--- a/net/ipv6/netfilter/ip6table_security.c
+++ b/net/ipv6/netfilter/ip6table_security.c
@@ -58,7 +58,7 @@ static int __net_init ip6table_security_net_init(struct net *net)
58 net->ipv6.ip6table_security = 58 net->ipv6.ip6table_security =
59 ip6t_register_table(net, &security_table, repl); 59 ip6t_register_table(net, &security_table, repl);
60 kfree(repl); 60 kfree(repl);
61 return PTR_RET(net->ipv6.ip6table_security); 61 return PTR_ERR_OR_ZERO(net->ipv6.ip6table_security);
62} 62}
63 63
64static void __net_exit ip6table_security_net_exit(struct net *net) 64static void __net_exit ip6table_security_net_exit(struct net *net)
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci
index 2274638d005b..e18f8402e37c 100644
--- a/scripts/coccinelle/api/ptr_ret.cocci
+++ b/scripts/coccinelle/api/ptr_ret.cocci
@@ -1,5 +1,5 @@
1/// 1///
2/// Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR 2/// Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
3/// 3///
4// Confidence: High 4// Confidence: High
5// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. 5// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
@@ -7,7 +7,7 @@
7// URL: http://coccinelle.lip6.fr/ 7// URL: http://coccinelle.lip6.fr/
8// Options: --no-includes --include-headers 8// Options: --no-includes --include-headers
9// 9//
10// Keywords: ERR_PTR, PTR_ERR, PTR_RET 10// Keywords: ERR_PTR, PTR_ERR, PTR_RET, PTR_ERR_OR_ZERO
11// Version min: 2.6.39 11// Version min: 2.6.39
12// 12//
13 13
@@ -21,21 +21,21 @@ expression ptr;
21@@ 21@@
22 22
23- if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; 23- if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
24+ return PTR_RET(ptr); 24+ return PTR_ERR_OR_ZERO(ptr);
25 25
26@depends on patch@ 26@depends on patch@
27expression ptr; 27expression ptr;
28@@ 28@@
29 29
30- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; 30- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
31+ return PTR_RET(ptr); 31+ return PTR_ERR_OR_ZERO(ptr);
32 32
33@depends on patch@ 33@depends on patch@
34expression ptr; 34expression ptr;
35@@ 35@@
36 36
37- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0) 37- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0)
38+ PTR_RET(ptr) 38+ PTR_ERR_OR_ZERO(ptr)
39 39
40@r1 depends on !patch@ 40@r1 depends on !patch@
41expression ptr; 41expression ptr;
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index 8ca9ecc5ac57..122c0c18b9dd 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -158,7 +158,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
158 return -EINVAL; 158 return -EINVAL;
159 } 159 }
160 160
161 return PTR_RET(codec->control_data); 161 return PTR_ERR_OR_ZERO(codec->control_data);
162} 162}
163EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); 163EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
164#else 164#else