Re: [Cocci] [PATCH] scripts/coccinelle: ptr_ret: Add ternary operator version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, 21 Aug 2012, Lars-Peter Clausen wrote:

> Add a ternary operator version of the open-coded PTR_RET().
>
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
> ---
>  scripts/coccinelle/api/ptr_ret.cocci |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci
> index cbfd08c..15f076f 100644
> --- a/scripts/coccinelle/api/ptr_ret.cocci
> +++ b/scripts/coccinelle/api/ptr_ret.cocci
> @@ -30,6 +30,13 @@ expression ptr;
>  - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
>  + return PTR_RET(ptr);
>
> +@depends on patch@
> +expression ptr;
> +@@
> +
> +- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0)
> ++ PTR_RET(ptr)
> +
>  @r1 depends on !patch@
>  expression ptr;
>  position p1;
> @@ -44,6 +51,13 @@ position p2;
>
>  * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
>
> +@r3 depends on !patch@
> +expression ptr;
> +position p3;
> +@@
> +
> +* IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0
> +
>  @script:python depends on org@
>  p << r1.p1;
>  @@
> @@ -57,6 +71,12 @@ p << r2.p2;
>
>  coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
>
> +@script:python depends on org@
> +p << r3.p3;
> +@@
> +
> +coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
> +
>  @script:python depends on report@
>  p << r1.p1;
>  @@
> @@ -68,3 +88,9 @@ p << r2.p2;
>  @@
>
>  coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
> +
> +@script:python depends on report@
> +p << r3.p3;
> +@@
> +
> +coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")

Signed-off-by: Julia Lawall <Julia.Lawall@xxxxxxx>

> --
> 1.7.2.5
>
> _______________________________________________
> Cocci mailing list
> Cocci@xxxxxxx
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Linux Kbuild]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Tape]     [Linux Input]     [Linux LEDS]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [AutoFS]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]