diff mbox

scsi: libfc: pass an error pointer to fc_disc_error()

Message ID 20170712073022.e24r3iad7jqxarn6@mwanda (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Dan Carpenter July 12, 2017, 7:30 a.m. UTC
This patch is basically to silence a static checker warning.

    drivers/scsi/libfc/fc_disc.c:326 fc_disc_error()
    warn: passing a valid pointer to 'PTR_ERR'

It doesn't affect runtime because it treats -ENOMEM and a valid pointer
the same.  But the documentation says we should be passing an error
pointer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Johannes Thumshirn July 12, 2017, 7:54 a.m. UTC | #1
On Wed, Jul 12, 2017 at 10:30:22AM +0300, Dan Carpenter wrote:
> This patch is basically to silence a static checker warning.
> 
>     drivers/scsi/libfc/fc_disc.c:326 fc_disc_error()
>     warn: passing a valid pointer to 'PTR_ERR'
> 
> It doesn't affect runtime because it treats -ENOMEM and a valid pointer
> the same.  But the documentation says we should be passing an error
> pointer.

Acked-by: Johannes Thumshirn <jth@kernel.org>
Martin K. Petersen July 12, 2017, 9:25 p.m. UTC | #2
Dan,

> This patch is basically to silence a static checker warning.
>
>     drivers/scsi/libfc/fc_disc.c:326 fc_disc_error()
>     warn: passing a valid pointer to 'PTR_ERR'
>
> It doesn't affect runtime because it treats -ENOMEM and a valid pointer
> the same.  But the documentation says we should be passing an error
> pointer.

Applied to 4.13/scsi-fixes. Thank you!
diff mbox

Patch

diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index fd501f8dbb11..8660f923ace0 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -573,7 +573,7 @@  static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
 		event = DISC_EV_FAILED;
 	}
 	if (error)
-		fc_disc_error(disc, fp);
+		fc_disc_error(disc, ERR_PTR(error));
 	else if (event != DISC_EV_NONE)
 		fc_disc_done(disc, event);
 	fc_frame_free(fp);