libsrp: remove unreachable kfree
srp_iu_pool_alloc implements what seems like a standard "common exit path with gotos" but there's only one way to reach it. Additionally the kfree(q->items) is unreachable.
fold the error path back into the if.
Signed-off-by Dave Jones <[email protected]>
drivers/scsi/libsrp.c +5 -7
@@ -55,9 +55,12 @@ static int srp_iu_pool_alloc(struct srp_queue *q, size_t max, q->pool =kcalloc (max,sizeof (struct iu_entry *),GFP_KERNEL );if (!q->pool)return -ENOMEM ; + q->items =kcalloc (max,sizeof (struct iu_entry ),GFP_KERNEL ); -if (!q->items) - goto free_pool; +if (!q->items) { +kfree (q->pool); +return -ENOMEM ; + }spin_lock_init (&q->lock);kfifo_init (&q->queue, (void *) q->pool, max *sizeof (void *));
@@ -68,11 +71,6 @@ static int srp_iu_pool_alloc(struct srp_queue *q, size_t max, iue++; }return 0 ; - -kfree (q->items); -free_pool: -kfree (q->pool); -return -ENOMEM ; }static void srp_iu_pool_free (struct srp_queue *q)