linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning
@ 2020-08-18 11:42 YueHaibing
  2020-08-18 16:24 ` kernel test robot
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: YueHaibing @ 2020-08-18 11:42 UTC (permalink / raw)
  To: hare, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, YueHaibing

drivers/scsi/libfc/fc_disc.c:304
 fc_disc_error() warn: passing zero to 'PTR_ERR'

fc_disc_error() expect a ERR_PTR pointer, so pass
ERR_PTR(err) to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/scsi/libfc/fc_disc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index d8cbc9c0e766..1077fcff4d50 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -343,6 +343,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
 {
 	struct fc_frame *fp;
 	struct fc_lport *lport = fc_disc_lport(disc);
+	int err;
 
 	lockdep_assert_held(&disc->disc_mutex);
 
@@ -356,8 +357,10 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
 	fp = fc_frame_alloc(lport,
 			    sizeof(struct fc_ct_hdr) +
 			    sizeof(struct fc_ns_gid_ft));
-	if (!fp)
+	if (!fp) {
+		err = -ENOMEM;
 		goto err;
+	}
 
 	if (lport->tt.elsct_send(lport, 0, fp,
 				 FC_NS_GPN_FT,
@@ -365,7 +368,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
 				 disc, 3 * lport->r_a_tov))
 		return;
 err:
-	fc_disc_error(disc, NULL);
+	fc_disc_error(disc, ERR_PTR(err));
 }
 
 /**
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-22  3:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 11:42 [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning YueHaibing
2020-08-18 16:24 ` kernel test robot
2020-08-19  2:05 ` [PATCH v2] " YueHaibing
2020-08-21  2:21   ` Martin K. Petersen
2020-08-21 11:03     ` Yuehaibing
2020-08-21 11:02 ` [PATCH v3] " YueHaibing
2020-08-21 12:23 ` [PATCH] " Dan Carpenter
2020-09-09 13:54 ` [PATCH v4] " YueHaibing
2020-09-15 21:52   ` Martin K. Petersen
2020-09-22  3:57   ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).