mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 10:30:52 +07:00
PTR_RET() is a weird name, and led to some confusing usage. We ended
up with PTR_ERR_OR_ZERO(), and replacing or fixing all the usages. This has been sitting in linux-next for a whole cycle. Thanks, Rusty. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJSJo+1AAoJENkgDmzRrbjxIC4QALJK95o8AUXuwUkl+2fmFkUt hh2/PJ1vDYgk4Xt0J6hyoK7XMa0H1RkbBrROuDdsBnorMFpEsGcgdkUZte9ufoAS 97Bg+7N0KPbTB/S8vOwtW1vbERTJIVPN2uf6h1Wqm9Xc2puCh3HbMMr1AWMGu0WQ NqY5+Zz8zecy1UOrMhEP6H1CjeQcL1w1DO6YM5ydeqlKNzAz+JMfDXriLPDwiE7+ XFPDF/O3Vtd2ckA7L70Lio7hfHwxV5U4WwFVfiwls98XB4jcZqDKIoh1r8z4SRgR +0Rae2DN3BaOabGMr//5XdrzQVpwJTh5m2w8BAOHJvCJ9HR7Sq29UIN4u+TowZBy L2xYo4dvFxkympwu5zEd3c7vHYWKIaqmSq5PIjr4gF/uIo2OeOTrpPIK782ZEYb7 e+qUgOEM05V9AmQZCrSZeP9u474Sj8ow3sCtWxfdRtwNfoEIcUXsNNJd/zDHlVtW cEtXqc2xXIpcuUJQWlSaGp8fmRQjVZPzrLKYLM2m39ZcOOJbf5rzQAYS7hHPosIa SK+YVux/+Zzi+Xo/vXq1OlM/SruCr5S7JOgCxLowoQ88vupgXME6uPyC8EO+QQ50 GsrHes5ZNLbk0uVsfcexIyojkUnyvDmmnDpv+1zdC6RgZLJQn8OXp5yNhHhnhrFT BiHX6YFWtDDqRlVv8Q0F =LeaW -----END PGP SIGNATURE----- Merge tag 'PTR_RET-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux Pull PTR_RET() removal patches from Rusty Russell: "PTR_RET() is a weird name, and led to some confusing usage. We ended up with PTR_ERR_OR_ZERO(), and replacing or fixing all the usages. This has been sitting in linux-next for a whole cycle" [ There are still some PTR_RET users scattered about, with some of them possibly being new, but most of them existing in Rusty's tree too. We have that #define PTR_RET(p) PTR_ERR_OR_ZERO(p) thing in <linux/err.h>, so they continue to work for now - Linus ] * tag 'PTR_RET-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: GFS2: Replace PTR_RET with PTR_ERR_OR_ZERO Btrfs: volume: Replace PTR_RET with PTR_ERR_OR_ZERO drm/cma: Replace PTR_RET with PTR_ERR_OR_ZERO sh_veu: Replace PTR_RET with PTR_ERR_OR_ZERO dma-buf: Replace PTR_RET with PTR_ERR_OR_ZERO drivers/rtc: Replace PTR_RET with PTR_ERR_OR_ZERO mm/oom_kill: remove weird use of ERR_PTR()/PTR_ERR(). staging/zcache: don't use PTR_RET(). remoteproc: don't use PTR_RET(). pinctrl: don't use PTR_RET(). acpi: Replace weird use of PTR_RET. s390: Replace weird use of PTR_RET. PTR_RET is now PTR_ERR_OR_ZERO(): Replace most. PTR_RET is now PTR_ERR_OR_ZERO
This commit is contained in:
commit
27703bb4a6
@ -181,7 +181,7 @@ int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
|
||||
sizeof(struct omap_i2c_bus_platform_data));
|
||||
WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
|
||||
|
||||
return PTR_RET(pdev);
|
||||
return PTR_ERR_OR_ZERO(pdev);
|
||||
}
|
||||
|
||||
static int __init omap_i2c_cmdline(void)
|
||||
|
@ -56,7 +56,7 @@ static int __init amiga_init_bus(void)
|
||||
n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
|
||||
pdev = platform_device_register_simple("amiga-zorro", -1,
|
||||
zorro_resources, n);
|
||||
return PTR_RET(pdev);
|
||||
return PTR_ERR_OR_ZERO(pdev);
|
||||
}
|
||||
|
||||
subsys_initcall(amiga_init_bus);
|
||||
|
@ -90,7 +90,7 @@ static int __init rtc_init(void)
|
||||
return -ENODEV;
|
||||
|
||||
pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
|
||||
return PTR_RET(pdev);
|
||||
return PTR_ERR_OR_ZERO(pdev);
|
||||
}
|
||||
|
||||
module_init(rtc_init);
|
||||
|
@ -338,6 +338,6 @@ static __init int q40_add_kbd_device(void)
|
||||
return -ENODEV;
|
||||
|
||||
pdev = platform_device_register_simple("q40kbd", -1, NULL, 0);
|
||||
return PTR_RET(pdev);
|
||||
return PTR_ERR_OR_ZERO(pdev);
|
||||
}
|
||||
arch_initcall(q40_add_kbd_device);
|
||||
|
@ -105,7 +105,7 @@ static int __init fail_iommu_debugfs(void)
|
||||
struct dentry *dir = fault_create_debugfs_attr("fail_iommu",
|
||||
NULL, &fail_iommu);
|
||||
|
||||
return PTR_RET(dir);
|
||||
return PTR_ERR_OR_ZERO(dir);
|
||||
}
|
||||
late_initcall(fail_iommu_debugfs);
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ static int __init rtc_init(void)
|
||||
|
||||
pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
|
||||
|
||||
return PTR_RET(pdev);
|
||||
return PTR_ERR_OR_ZERO(pdev);
|
||||
}
|
||||
|
||||
module_init(rtc_init);
|
||||
|
@ -90,7 +90,7 @@ static int __init ps3_rtc_init(void)
|
||||
|
||||
pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
|
||||
|
||||
return PTR_RET(pdev);
|
||||
return PTR_ERR_OR_ZERO(pdev);
|
||||
}
|
||||
|
||||
module_init(ps3_rtc_init);
|
||||
|
@ -62,7 +62,7 @@ static int __init add_rtc(void)
|
||||
pd = platform_device_register_simple("rtc_cmos", -1,
|
||||
&res[0], num_res);
|
||||
|
||||
return PTR_RET(pd);
|
||||
return PTR_ERR_OR_ZERO(pd);
|
||||
}
|
||||
fs_initcall(add_rtc);
|
||||
|
||||
|
@ -105,7 +105,7 @@ void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df)
|
||||
int hypfs_dbfs_init(void)
|
||||
{
|
||||
dbfs_dir = debugfs_create_dir("s390_hypfs", NULL);
|
||||
return PTR_RET(dbfs_dir);
|
||||
return PTR_ERR_OR_ZERO(dbfs_dir);
|
||||
}
|
||||
|
||||
void hypfs_dbfs_exit(void)
|
||||
|
@ -42,9 +42,11 @@ static inline void __user *__gptr_to_uptr(struct kvm_vcpu *vcpu,
|
||||
({ \
|
||||
__typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\
|
||||
int __mask = sizeof(__typeof__(*(gptr))) - 1; \
|
||||
int __ret = PTR_RET((void __force *)__uptr); \
|
||||
int __ret; \
|
||||
\
|
||||
if (!__ret) { \
|
||||
if (IS_ERR((void __force *)__uptr)) { \
|
||||
__ret = PTR_ERR((void __force *)__uptr); \
|
||||
} else { \
|
||||
BUG_ON((unsigned long)__uptr & __mask); \
|
||||
__ret = get_user(x, __uptr); \
|
||||
} \
|
||||
@ -55,9 +57,11 @@ static inline void __user *__gptr_to_uptr(struct kvm_vcpu *vcpu,
|
||||
({ \
|
||||
__typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\
|
||||
int __mask = sizeof(__typeof__(*(gptr))) - 1; \
|
||||
int __ret = PTR_RET((void __force *)__uptr); \
|
||||
int __ret; \
|
||||
\
|
||||
if (!__ret) { \
|
||||
if (IS_ERR((void __force *)__uptr)) { \
|
||||
__ret = PTR_ERR((void __force *)__uptr); \
|
||||
} else { \
|
||||
BUG_ON((unsigned long)__uptr & __mask); \
|
||||
__ret = put_user(x, __uptr); \
|
||||
} \
|
||||
|
@ -231,16 +231,19 @@ static struct task_struct *ps_tsks[NR_CPUS];
|
||||
static unsigned int ps_tsk_num;
|
||||
static int create_power_saving_task(void)
|
||||
{
|
||||
int rc = -ENOMEM;
|
||||
int rc;
|
||||
|
||||
ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread,
|
||||
(void *)(unsigned long)ps_tsk_num,
|
||||
"acpi_pad/%d", ps_tsk_num);
|
||||
rc = PTR_RET(ps_tsks[ps_tsk_num]);
|
||||
if (!rc)
|
||||
ps_tsk_num++;
|
||||
else
|
||||
|
||||
if (IS_ERR(ps_tsks[ps_tsk_num])) {
|
||||
rc = PTR_ERR(ps_tsks[ps_tsk_num]);
|
||||
ps_tsks[ps_tsk_num] = NULL;
|
||||
} else {
|
||||
rc = 0;
|
||||
ps_tsk_num++;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ int dma_buf_debugfs_create_file(const char *name,
|
||||
d = debugfs_create_file(name, S_IRUGO, dma_buf_debugfs_dir,
|
||||
write, &dma_buf_debug_fops);
|
||||
|
||||
return PTR_RET(d);
|
||||
return PTR_ERR_OR_ZERO(d);
|
||||
}
|
||||
#else
|
||||
static inline int dma_buf_init_debugfs(void)
|
||||
|
@ -353,7 +353,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index)
|
||||
|
||||
dev = device_create(srom_class, &platform_bus,
|
||||
MKDEV(srom_major, index), srom, "%d", index);
|
||||
return PTR_RET(dev);
|
||||
return PTR_ERR_OR_ZERO(dev);
|
||||
}
|
||||
|
||||
/** srom_init() - Initialize the driver's module. */
|
||||
|
@ -215,7 +215,7 @@ int drm_gem_cma_dumb_create(struct drm_file *file_priv,
|
||||
|
||||
cma_obj = drm_gem_cma_create_with_handle(file_priv, dev,
|
||||
args->size, &args->handle);
|
||||
return PTR_RET(cma_obj);
|
||||
return PTR_ERR_OR_ZERO(cma_obj);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(drm_gem_cma_dumb_create);
|
||||
|
||||
|
@ -3208,7 +3208,7 @@ static int cma_join_ib_multicast(struct rdma_id_private *id_priv,
|
||||
id_priv->id.port_num, &rec,
|
||||
comp_mask, GFP_KERNEL,
|
||||
cma_ib_mc_handler, mc);
|
||||
return PTR_RET(mc->multicast.ib);
|
||||
return PTR_ERR_OR_ZERO(mc->multicast.ib);
|
||||
}
|
||||
|
||||
static void iboe_mcast_work_handler(struct work_struct *work)
|
||||
|
@ -359,7 +359,7 @@ static int sh_veu_context_init(struct sh_veu_dev *veu)
|
||||
veu->m2m_ctx = v4l2_m2m_ctx_init(veu->m2m_dev, veu,
|
||||
sh_veu_queue_init);
|
||||
|
||||
return PTR_RET(veu->m2m_ctx);
|
||||
return PTR_ERR_OR_ZERO(veu->m2m_ctx);
|
||||
}
|
||||
|
||||
static int sh_veu_querycap(struct file *file, void *priv,
|
||||
|
@ -996,7 +996,7 @@ static int __init cops_module_init(void)
|
||||
printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n",
|
||||
cardname);
|
||||
cops_dev = cops_probe(-1);
|
||||
return PTR_RET(cops_dev);
|
||||
return PTR_ERR_OR_ZERO(cops_dev);
|
||||
}
|
||||
|
||||
static void __exit cops_module_exit(void)
|
||||
|
@ -1243,7 +1243,7 @@ static int __init ltpc_module_init(void)
|
||||
"ltpc: Autoprobing is not recommended for modules\n");
|
||||
|
||||
dev_ltpc = ltpc_probe();
|
||||
return PTR_RET(dev_ltpc);
|
||||
return PTR_ERR_OR_ZERO(dev_ltpc);
|
||||
}
|
||||
module_init(ltpc_module_init);
|
||||
#endif
|
||||
|
@ -1147,7 +1147,7 @@ static struct net_device *atarilance_dev;
|
||||
static int __init atarilance_module_init(void)
|
||||
{
|
||||
atarilance_dev = atarilance_probe(-1);
|
||||
return PTR_RET(atarilance_dev);
|
||||
return PTR_ERR_OR_ZERO(atarilance_dev);
|
||||
}
|
||||
|
||||
static void __exit atarilance_module_exit(void)
|
||||
|
@ -188,7 +188,7 @@ static struct net_device *dev_mvme147_lance;
|
||||
int __init init_module(void)
|
||||
{
|
||||
dev_mvme147_lance = mvme147lance_probe(-1);
|
||||
return PTR_RET(dev_mvme147_lance);
|
||||
return PTR_ERR_OR_ZERO(dev_mvme147_lance);
|
||||
}
|
||||
|
||||
void __exit cleanup_module(void)
|
||||
|
@ -1238,7 +1238,7 @@ MODULE_PARM_DESC(dma, "ni6510 ISA DMA channel (ignored for some cards)");
|
||||
int __init init_module(void)
|
||||
{
|
||||
dev_ni65 = ni65_probe(-1);
|
||||
return PTR_RET(dev_ni65);
|
||||
return PTR_ERR_OR_ZERO(dev_ni65);
|
||||
}
|
||||
|
||||
void __exit cleanup_module(void)
|
||||
|
@ -940,7 +940,7 @@ static struct net_device *sun3lance_dev;
|
||||
int __init init_module(void)
|
||||
{
|
||||
sun3lance_dev = sun3lance_probe(-1);
|
||||
return PTR_RET(sun3lance_dev);
|
||||
return PTR_ERR_OR_ZERO(sun3lance_dev);
|
||||
}
|
||||
|
||||
void __exit cleanup_module(void)
|
||||
|
@ -50,7 +50,7 @@ int brcmf_debugfs_attach(struct brcmf_pub *drvr)
|
||||
return -ENODEV;
|
||||
|
||||
drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
|
||||
return PTR_RET(drvr->dbgfs_dir);
|
||||
return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
|
||||
}
|
||||
|
||||
void brcmf_debugfs_detach(struct brcmf_pub *drvr)
|
||||
|
@ -56,7 +56,7 @@ int brcms_debugfs_attach(struct brcms_pub *drvr)
|
||||
|
||||
drvr->dbgfs_dir = debugfs_create_dir(
|
||||
dev_name(&drvr->wlc->hw->d11core->dev), root_folder);
|
||||
return PTR_RET(drvr->dbgfs_dir);
|
||||
return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
|
||||
}
|
||||
|
||||
void brcms_debugfs_detach(struct brcms_pub *drvr)
|
||||
|
@ -785,7 +785,7 @@ static int dove_pinctrl_probe(struct platform_device *pdev)
|
||||
clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(clk)) {
|
||||
dev_err(&pdev->dev, "Unable to get pdma clock");
|
||||
return PTR_RET(clk);
|
||||
return PTR_ERR(clk);
|
||||
}
|
||||
clk_prepare_enable(clk);
|
||||
|
||||
|
@ -176,7 +176,7 @@ static int __init samsungq10_init(void)
|
||||
samsungq10_probe,
|
||||
NULL, 0, NULL, 0);
|
||||
|
||||
return PTR_RET(samsungq10_device);
|
||||
return PTR_ERR_OR_ZERO(samsungq10_device);
|
||||
}
|
||||
|
||||
static void __exit samsungq10_exit(void)
|
||||
|
@ -219,7 +219,7 @@ static int fan53555_regulator_register(struct fan53555_device_info *di,
|
||||
rdesc->owner = THIS_MODULE;
|
||||
|
||||
di->rdev = regulator_register(&di->desc, config);
|
||||
return PTR_RET(di->rdev);
|
||||
return PTR_ERR_OR_ZERO(di->rdev);
|
||||
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ static int reset_assert(struct device *dev)
|
||||
dsp_clk = clk_get(dev, NULL);
|
||||
if (IS_ERR(dsp_clk)) {
|
||||
dev_err(dev, "clk_get error: %ld\n", PTR_ERR(dsp_clk));
|
||||
return PTR_RET(dsp_clk);
|
||||
return PTR_ERR(dsp_clk);
|
||||
}
|
||||
|
||||
davinci_clk_reset_assert(dsp_clk);
|
||||
|
@ -250,7 +250,7 @@ static int da9052_rtc_probe(struct platform_device *pdev)
|
||||
|
||||
rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
|
||||
&da9052_rtc_ops, THIS_MODULE);
|
||||
return PTR_RET(rtc->rtc);
|
||||
return PTR_ERR_OR_ZERO(rtc->rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver da9052_rtc_driver = {
|
||||
|
@ -268,7 +268,7 @@ static int isl12022_probe(struct i2c_client *client,
|
||||
isl12022->rtc = devm_rtc_device_register(&client->dev,
|
||||
isl12022_driver.driver.name,
|
||||
&isl12022_rtc_ops, THIS_MODULE);
|
||||
return PTR_RET(isl12022->rtc);
|
||||
return PTR_ERR_OR_ZERO(isl12022->rtc);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id isl12022_id[] = {
|
||||
|
@ -175,7 +175,7 @@ static int m48t35_probe(struct platform_device *pdev)
|
||||
|
||||
priv->rtc = devm_rtc_device_register(&pdev->dev, "m48t35",
|
||||
&m48t35_ops, THIS_MODULE);
|
||||
return PTR_RET(priv->rtc);
|
||||
return PTR_ERR_OR_ZERO(priv->rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver m48t35_platform_driver = {
|
||||
|
@ -264,7 +264,7 @@ static int pcf8563_probe(struct i2c_client *client,
|
||||
pcf8563_driver.driver.name,
|
||||
&pcf8563_rtc_ops, THIS_MODULE);
|
||||
|
||||
return PTR_RET(pcf8563->rtc);
|
||||
return PTR_ERR_OR_ZERO(pcf8563->rtc);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id pcf8563_id[] = {
|
||||
|
@ -285,7 +285,7 @@ static int pcf8583_probe(struct i2c_client *client,
|
||||
pcf8583_driver.driver.name,
|
||||
&pcf8583_rtc_ops, THIS_MODULE);
|
||||
|
||||
return PTR_RET(pcf8583->rtc);
|
||||
return PTR_ERR_OR_ZERO(pcf8583->rtc);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id pcf8583_id[] = {
|
||||
|
@ -902,7 +902,7 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
|
||||
master = fsl_spi_probe(&pdev->dev, mem, irq);
|
||||
return PTR_RET(master);
|
||||
return PTR_ERR_OR_ZERO(master);
|
||||
}
|
||||
|
||||
static int plat_mpc8xxx_spi_remove(struct platform_device *pdev)
|
||||
|
@ -603,7 +603,7 @@ static int spidev_probe(struct spi_device *spi)
|
||||
dev = device_create(spidev_class, &spi->dev, spidev->devt,
|
||||
spidev, "spidev%d.%d",
|
||||
spi->master->bus_num, spi->chip_select);
|
||||
status = PTR_RET(dev);
|
||||
status = PTR_ERR_OR_ZERO(dev);
|
||||
} else {
|
||||
dev_dbg(&spi->dev, "no minor number available!\n");
|
||||
status = -ENODEV;
|
||||
|
@ -189,7 +189,7 @@ int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
|
||||
d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
|
||||
write, &dss_debug_fops);
|
||||
|
||||
return PTR_RET(d);
|
||||
return PTR_ERR_OR_ZERO(d);
|
||||
}
|
||||
#else /* CONFIG_OMAP2_DSS_DEBUGFS */
|
||||
static inline int dss_initialize_debugfs(void)
|
||||
|
@ -747,7 +747,7 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info *fs_info)
|
||||
WARN_ON(atomic_xchg(
|
||||
&fs_info->mutually_exclusive_operation_running, 1));
|
||||
task = kthread_run(btrfs_dev_replace_kthread, fs_info, "btrfs-devrepl");
|
||||
return PTR_RET(task);
|
||||
return PTR_ERR_OR_ZERO(task);
|
||||
}
|
||||
|
||||
static int btrfs_dev_replace_kthread(void *data)
|
||||
|
@ -3174,7 +3174,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
|
||||
found_key.type = BTRFS_INODE_ITEM_KEY;
|
||||
found_key.offset = 0;
|
||||
inode = btrfs_iget(root->fs_info->sb, &found_key, root, NULL);
|
||||
ret = PTR_RET(inode);
|
||||
ret = PTR_ERR_OR_ZERO(inode);
|
||||
if (ret && ret != -ESTALE)
|
||||
goto out;
|
||||
|
||||
|
@ -3302,7 +3302,7 @@ int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info)
|
||||
}
|
||||
|
||||
tsk = kthread_run(balance_kthread, fs_info, "btrfs-balance");
|
||||
return PTR_RET(tsk);
|
||||
return PTR_ERR_OR_ZERO(tsk);
|
||||
}
|
||||
|
||||
int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
|
||||
|
@ -52,7 +52,7 @@ static inline void * __must_check ERR_CAST(__force const void *ptr)
|
||||
return (void *) ptr;
|
||||
}
|
||||
|
||||
static inline int __must_check PTR_RET(__force const void *ptr)
|
||||
static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
|
||||
{
|
||||
if (IS_ERR(ptr))
|
||||
return PTR_ERR(ptr);
|
||||
@ -60,6 +60,9 @@ static inline int __must_check PTR_RET(__force const void *ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deprecated */
|
||||
#define PTR_RET(p) PTR_ERR_OR_ZERO(p)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_ERR_H */
|
||||
|
@ -288,7 +288,7 @@ enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
|
||||
|
||||
/*
|
||||
* Simple selection loop. We chose the process with the highest
|
||||
* number of 'points'.
|
||||
* number of 'points'. Returns -1 on scan abort.
|
||||
*
|
||||
* (not docbooked, we don't want this one cluttering up the manual)
|
||||
*/
|
||||
@ -314,7 +314,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
|
||||
continue;
|
||||
case OOM_SCAN_ABORT:
|
||||
rcu_read_unlock();
|
||||
return ERR_PTR(-1UL);
|
||||
return (struct task_struct *)(-1UL);
|
||||
case OOM_SCAN_OK:
|
||||
break;
|
||||
};
|
||||
@ -657,7 +657,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
|
||||
dump_header(NULL, gfp_mask, order, NULL, mpol_mask);
|
||||
panic("Out of memory and no killable processes...\n");
|
||||
}
|
||||
if (PTR_ERR(p) != -1UL) {
|
||||
if (p != (void *)-1UL) {
|
||||
oom_kill_process(p, gfp_mask, order, points, totalpages, NULL,
|
||||
nodemask, "Out of memory");
|
||||
killed = 1;
|
||||
|
@ -590,7 +590,7 @@ int __init bt_sysfs_init(void)
|
||||
|
||||
bt_class = class_create(THIS_MODULE, "bluetooth");
|
||||
|
||||
return PTR_RET(bt_class);
|
||||
return PTR_ERR_OR_ZERO(bt_class);
|
||||
}
|
||||
|
||||
void bt_sysfs_cleanup(void)
|
||||
|
@ -64,7 +64,7 @@ static int ebt_broute(struct sk_buff *skb)
|
||||
static int __net_init broute_net_init(struct net *net)
|
||||
{
|
||||
net->xt.broute_table = ebt_register_table(net, &broute_table);
|
||||
return PTR_RET(net->xt.broute_table);
|
||||
return PTR_ERR_OR_ZERO(net->xt.broute_table);
|
||||
}
|
||||
|
||||
static void __net_exit broute_net_exit(struct net *net)
|
||||
|
@ -100,7 +100,7 @@ static struct nf_hook_ops ebt_ops_filter[] __read_mostly = {
|
||||
static int __net_init frame_filter_net_init(struct net *net)
|
||||
{
|
||||
net->xt.frame_filter = ebt_register_table(net, &frame_filter);
|
||||
return PTR_RET(net->xt.frame_filter);
|
||||
return PTR_ERR_OR_ZERO(net->xt.frame_filter);
|
||||
}
|
||||
|
||||
static void __net_exit frame_filter_net_exit(struct net *net)
|
||||
|
@ -100,7 +100,7 @@ static struct nf_hook_ops ebt_ops_nat[] __read_mostly = {
|
||||
static int __net_init frame_nat_net_init(struct net *net)
|
||||
{
|
||||
net->xt.frame_nat = ebt_register_table(net, &frame_nat);
|
||||
return PTR_RET(net->xt.frame_nat);
|
||||
return PTR_ERR_OR_ZERO(net->xt.frame_nat);
|
||||
}
|
||||
|
||||
static void __net_exit frame_nat_net_exit(struct net *net)
|
||||
|
@ -48,7 +48,7 @@ static int __net_init arptable_filter_net_init(struct net *net)
|
||||
net->ipv4.arptable_filter =
|
||||
arpt_register_table(net, &packet_filter, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv4.arptable_filter);
|
||||
return PTR_ERR_OR_ZERO(net->ipv4.arptable_filter);
|
||||
}
|
||||
|
||||
static void __net_exit arptable_filter_net_exit(struct net *net)
|
||||
|
@ -69,7 +69,7 @@ static int __net_init iptable_filter_net_init(struct net *net)
|
||||
net->ipv4.iptable_filter =
|
||||
ipt_register_table(net, &packet_filter, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv4.iptable_filter);
|
||||
return PTR_ERR_OR_ZERO(net->ipv4.iptable_filter);
|
||||
}
|
||||
|
||||
static void __net_exit iptable_filter_net_exit(struct net *net)
|
||||
|
@ -107,7 +107,7 @@ static int __net_init iptable_mangle_net_init(struct net *net)
|
||||
net->ipv4.iptable_mangle =
|
||||
ipt_register_table(net, &packet_mangler, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv4.iptable_mangle);
|
||||
return PTR_ERR_OR_ZERO(net->ipv4.iptable_mangle);
|
||||
}
|
||||
|
||||
static void __net_exit iptable_mangle_net_exit(struct net *net)
|
||||
|
@ -292,7 +292,7 @@ static int __net_init iptable_nat_net_init(struct net *net)
|
||||
return -ENOMEM;
|
||||
net->ipv4.nat_table = ipt_register_table(net, &nf_nat_ipv4_table, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv4.nat_table);
|
||||
return PTR_ERR_OR_ZERO(net->ipv4.nat_table);
|
||||
}
|
||||
|
||||
static void __net_exit iptable_nat_net_exit(struct net *net)
|
||||
|
@ -48,7 +48,7 @@ static int __net_init iptable_raw_net_init(struct net *net)
|
||||
net->ipv4.iptable_raw =
|
||||
ipt_register_table(net, &packet_raw, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv4.iptable_raw);
|
||||
return PTR_ERR_OR_ZERO(net->ipv4.iptable_raw);
|
||||
}
|
||||
|
||||
static void __net_exit iptable_raw_net_exit(struct net *net)
|
||||
|
@ -66,7 +66,7 @@ static int __net_init iptable_security_net_init(struct net *net)
|
||||
net->ipv4.iptable_security =
|
||||
ipt_register_table(net, &security_table, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv4.iptable_security);
|
||||
return PTR_ERR_OR_ZERO(net->ipv4.iptable_security);
|
||||
}
|
||||
|
||||
static void __net_exit iptable_security_net_exit(struct net *net)
|
||||
|
@ -61,7 +61,7 @@ static int __net_init ip6table_filter_net_init(struct net *net)
|
||||
net->ipv6.ip6table_filter =
|
||||
ip6t_register_table(net, &packet_filter, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv6.ip6table_filter);
|
||||
return PTR_ERR_OR_ZERO(net->ipv6.ip6table_filter);
|
||||
}
|
||||
|
||||
static void __net_exit ip6table_filter_net_exit(struct net *net)
|
||||
|
@ -101,7 +101,7 @@ static int __net_init ip6table_mangle_net_init(struct net *net)
|
||||
net->ipv6.ip6table_mangle =
|
||||
ip6t_register_table(net, &packet_mangler, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv6.ip6table_mangle);
|
||||
return PTR_ERR_OR_ZERO(net->ipv6.ip6table_mangle);
|
||||
}
|
||||
|
||||
static void __net_exit ip6table_mangle_net_exit(struct net *net)
|
||||
|
@ -293,7 +293,7 @@ static int __net_init ip6table_nat_net_init(struct net *net)
|
||||
return -ENOMEM;
|
||||
net->ipv6.ip6table_nat = ip6t_register_table(net, &nf_nat_ipv6_table, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv6.ip6table_nat);
|
||||
return PTR_ERR_OR_ZERO(net->ipv6.ip6table_nat);
|
||||
}
|
||||
|
||||
static void __net_exit ip6table_nat_net_exit(struct net *net)
|
||||
|
@ -40,7 +40,7 @@ static int __net_init ip6table_raw_net_init(struct net *net)
|
||||
net->ipv6.ip6table_raw =
|
||||
ip6t_register_table(net, &packet_raw, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv6.ip6table_raw);
|
||||
return PTR_ERR_OR_ZERO(net->ipv6.ip6table_raw);
|
||||
}
|
||||
|
||||
static void __net_exit ip6table_raw_net_exit(struct net *net)
|
||||
|
@ -58,7 +58,7 @@ static int __net_init ip6table_security_net_init(struct net *net)
|
||||
net->ipv6.ip6table_security =
|
||||
ip6t_register_table(net, &security_table, repl);
|
||||
kfree(repl);
|
||||
return PTR_RET(net->ipv6.ip6table_security);
|
||||
return PTR_ERR_OR_ZERO(net->ipv6.ip6table_security);
|
||||
}
|
||||
|
||||
static void __net_exit ip6table_security_net_exit(struct net *net)
|
||||
|
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
|
||||
/// Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
|
||||
///
|
||||
// Confidence: High
|
||||
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
|
||||
@ -7,7 +7,7 @@
|
||||
// URL: http://coccinelle.lip6.fr/
|
||||
// Options: --no-includes --include-headers
|
||||
//
|
||||
// Keywords: ERR_PTR, PTR_ERR, PTR_RET
|
||||
// Keywords: ERR_PTR, PTR_ERR, PTR_RET, PTR_ERR_OR_ZERO
|
||||
// Version min: 2.6.39
|
||||
//
|
||||
|
||||
@ -21,21 +21,21 @@ expression ptr;
|
||||
@@
|
||||
|
||||
- if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
|
||||
+ return PTR_RET(ptr);
|
||||
+ return PTR_ERR_OR_ZERO(ptr);
|
||||
|
||||
@depends on patch@
|
||||
expression ptr;
|
||||
@@
|
||||
|
||||
- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
|
||||
+ return PTR_RET(ptr);
|
||||
+ return PTR_ERR_OR_ZERO(ptr);
|
||||
|
||||
@depends on patch@
|
||||
expression ptr;
|
||||
@@
|
||||
|
||||
- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0)
|
||||
+ PTR_RET(ptr)
|
||||
+ PTR_ERR_OR_ZERO(ptr)
|
||||
|
||||
@r1 depends on !patch@
|
||||
expression ptr;
|
||||
|
@ -158,7 +158,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return PTR_RET(codec->control_data);
|
||||
return PTR_ERR_OR_ZERO(codec->control_data);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user