Archived
14
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/drivers/char/pcmcia/ipwireless
Julia Lawall d5bb2923cf drivers/char/pcmcia/ipwireless/main.c: Convert release_resource to release_region/release_mem_region
Request_region should be used with release_region, not release_resource.

This patch contains a number of changes, related to calls to request_region,
request_mem_region, and the associated error handling code.

1. For the call to request_region, the variable io_resource storing the
result is dropped.  The call to release_resource at the end of the function
is changed to a call to release_region with the first two arguments of
request_region as its arguments.  The same call to release_region is also
added to release_ipwireless.

2. The first call to request_mem_region is now tested and ret is set to
-EBUSY if the the call has failed.  This call was associated with the
initialization of ipw->attr_memory.  But the error handling code was
testing ipw->common_memory.  The definition of release_ipwireless also
suggests that this call should be associated with ipw->common_memory, not
ipw->attr_memory.

3. The second call to request_mem_region is now tested and ret is
set to -EBUSY if the the call has failed.

4. The various gotos to the error handling code is adjusted so that there
is no need for ifs.

5. Return the value stored in the ret variable rather than -1.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,E;
@@
(
*x = request_region(...)
|
*x = request_mem_region(...)
)
... when != release_region(x)
    when != x = E
* release_resource(x);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2011-02-19 12:22:16 +01:00
..
hardware.c pcmcia/ipwireless: don't use flush_scheduled_work() 2010-12-24 15:59:06 +01:00
hardware.h ipwireless: Constify buffer variables 2008-07-28 08:28:03 -07:00
main.c drivers/char/pcmcia/ipwireless/main.c: Convert release_resource to release_region/release_mem_region 2011-02-19 12:22:16 +01:00
main.h pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device 2010-09-29 17:20:23 +02:00
Makefile drivers/char/pcmcia/ipwireless/Makefile: Makefile: replace the use of <module>-objs with <module>-y 2010-10-27 18:03:15 -07:00
network.c pcmcia/ipwireless: don't use flush_scheduled_work() 2010-12-24 15:59:06 +01:00
network.h ipwireless: Preallocate received packet buffers with MRU size 2008-07-28 08:28:03 -07:00
setup_protocol.h
tty.c pcmcia/ipwireless: don't use flush_scheduled_work() 2010-12-24 15:59:06 +01:00
tty.h pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device 2010-09-29 17:20:23 +02:00