diff options
author | Julien Brunel <brunel@diku.dk> | 2008-08-21 19:46:30 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-08-21 19:46:39 +0200 |
commit | 0983e56835cbf4796e8f5780c549c32ac1c3afac (patch) | |
tree | d0a98012929abcd12d95c7a96184a69b1b1d4c6b /drivers/s390/char/tape_std.c | |
parent | Linux v2.6.27-rc4 (diff) | |
download | linux-0983e56835cbf4796e8f5780c549c32ac1c3afac.tar.xz linux-0983e56835cbf4796e8f5780c549c32ac1c3afac.zip |
[S390] drivers/s390: Use an IS_ERR test rather than a NULL test
In case of error, functions dasd_kmalloc_request and idal_buffer_alloc
return an ERR pointer, but never return the NULL pointer. So after a
call to one of these functions, a NULL test should be replaced by an
IS_ERR test.
A simplified version of the semantic patch that makes this change is
as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@correct_null_test@
expression x,E;
statement S1, S2;
@@
x =
(
dasd_kmalloc_request(...)
|
idal_buffer_alloc(...)
)
<... when != x = E
if (
(
- x@p2 != NULL
+ ! IS_ERR ( x )
|
- x@p2 == NULL
+ IS_ERR( x )
)
)
S1
else S2
...>
? x = E;
// </smpl>
Signed-off-by: Julien Brunel <brunel@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char/tape_std.c')
-rw-r--r-- | drivers/s390/char/tape_std.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c index 2a1af4e60be0..cc8fd781ee22 100644 --- a/drivers/s390/char/tape_std.c +++ b/drivers/s390/char/tape_std.c @@ -248,7 +248,7 @@ tape_std_mtsetblk(struct tape_device *device, int count) /* Allocate a new idal buffer. */ new = idal_buffer_alloc(count, 0); - if (new == NULL) + if (IS_ERR(new)) return -ENOMEM; if (device->char_data.idal_buf != NULL) idal_buffer_free(device->char_data.idal_buf); |