firmware class: Deletion of an unnecessary check before the function call "vunmap"
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 19 Nov 2014 10:38:38 +0000 (11:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Nov 2014 03:41:15 +0000 (19:41 -0800)
The vunmap() function performes also input parameter validation. Thus the test
around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_class.c

index 9962744b59aab08a9bf371d2178bc6397f50950f..58470c3953015b7180de159082b154e5eef70256 100644 (file)
@@ -591,8 +591,7 @@ static int fw_map_pages_buf(struct firmware_buf *buf)
        if (!buf->is_paged_buf)
                return 0;
 
-       if (buf->data)
-               vunmap(buf->data);
+       vunmap(buf->data);
        buf->data = vmap(buf->pages, buf->nr_pages, 0, PAGE_KERNEL_RO);
        if (!buf->data)
                return -ENOMEM;