From: Julia Lawall <[email protected]>
The pattern !E && !E->fld is nonsensical. The patch below updates this
according to the assumption that && should be ||. But perhaps another
solution was intended.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@disable and_comm@
expression E;
identifier fld;
@@
- !E && !E->fld
+ !E || !E->fld
// </smpl>
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/pci/hotplug/cpqphp_ctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -1139,7 +1139,7 @@ static u8 set_controller_speed(struct co
for(slot = ctrl->slot; slot; slot = slot->next) {
if (slot->device == (hp_slot + ctrl->slot_device_offset))
continue;
- if (!slot->hotplug_slot && !slot->hotplug_slot->info)
+ if (!slot->hotplug_slot || !slot->hotplug_slot->info)
continue;
if (slot->hotplug_slot->info->adapter_status == 0)
continue;
2008/10/14, Julia Lawall <[email protected]>:
> From: Julia Lawall <[email protected]>
> The semantic patch that makes this change is as follows:
> (http://www.emn.fr/x-info/coccinelle/)
>
> // <smpl>
> @disable and_comm@
> expression E;
> identifier fld;
> @@
>
> - !E && !E->fld
> + !E || !E->fld
> // </smpl>
>
What a great tool. :)
I guess you gathered a lot of precious patterns since the creation of
coccinelle!
On Tue, Oct 14, 2008 at 05:59:50PM +0200, Julia Lawall wrote:
> From: Julia Lawall <[email protected]>
>
> The pattern !E && !E->fld is nonsensical. The patch below updates this
> according to the assumption that && should be ||. But perhaps another
> solution was intended.
>
> Signed-off-by: Julia Lawall <[email protected]>
I think that's the right solution for this case.
Reviewed-by: Matthew Wilcox <[email protected]>
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."