NTB: correct ntb_peer_spad_read for case when callback is not supplied.
authorSteven Wahl <Steve_Wahl@Dell.com>
Thu, 8 Dec 2016 17:02:28 +0000 (17:02 +0000)
committerJon Mason <jdmason@kudzu.us>
Fri, 23 Dec 2016 21:10:50 +0000 (16:10 -0500)
Correct ntb_peer_spad_read for case when callback is not supplied

Signed-off-by: Steve Wahl <Steve.Wahl@dell.com>
Acked-by: Allen Hubbe <Allen.Hubbe@dell.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
include/linux/ntb.h

index 6f47562..816bd98 100644 (file)
@@ -968,6 +968,9 @@ static inline int ntb_peer_spad_addr(struct ntb_dev *ntb, int idx,
  */
 static inline u32 ntb_peer_spad_read(struct ntb_dev *ntb, int idx)
 {
+       if (!ntb->ops->peer_spad_read)
+               return 0;
+
        return ntb->ops->peer_spad_read(ntb, idx);
 }