s390/ism: indicate correct error reason in ism_alloc_dmb()
authorKarsten Graul <kgraul@linux.ibm.com>
Sun, 26 Jul 2020 18:34:27 +0000 (20:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jul 2020 17:30:01 +0000 (10:30 -0700)
When the ism driver allocates a new dmb in ism_alloc_dmb() it must
first check for and reserve a slot in the sba bitmap. When
find_next_zero_bit() finds no free slot then the return code is -ENOMEM.
This code conflicts with the error when the alloc() fails later in the
code. As a result of that the caller can not differentiate
between out-of-memory conditions and sba-bitmap-full conditions.
Fix that by using the return code -ENOSPC when the sba slot
reservation failed.

Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/ism_drv.c

index c7fade8..5fbe9ea 100644 (file)
@@ -231,7 +231,7 @@ static int ism_alloc_dmb(struct ism_dev *ism, struct smcd_dmb *dmb)
                bit = find_next_zero_bit(ism->sba_bitmap, ISM_NR_DMBS,
                                         ISM_DMB_BIT_OFFSET);
                if (bit == ISM_NR_DMBS)
-                       return -ENOMEM;
+                       return -ENOSPC;
 
                dmb->sba_idx = bit;
        }