diff mbox

[v2,1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree"

Message ID 62e64277-a6bc-9d9d-d80e-f3e515e7bcb3@users.sourceforge.net (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

SF Markus Elfring July 20, 2016, 11:30 a.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 19 Jul 2016 15:42:19 +0200

The kfree() function tests whether its argument is NULL and then
returns immediately. 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>
---
v2: Rebased on source files from "Linux next-20160719"

 drivers/xen/xen-scsiback.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jürgen Groß July 20, 2016, 11:44 a.m. UTC | #1
On 20/07/16 13:30, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 19 Jul 2016 15:42:19 +0200
> 
> The kfree() function tests whether its argument is NULL and then
> returns immediately. 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>

Even if already given, here it is again:

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index d6950e0..4a48c06 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -627,8 +627,7 @@  static void scsiback_device_action(struct vscsibk_pend *pending_req,
 	transport_generic_free_cmd(&pending_req->se_cmd, 1);
 	return;
 err:
-	if (tmr)
-		kfree(tmr);
+	kfree(tmr);
 	scsiback_do_resp_with_sense(NULL, err, 0, pending_req);
 }