nvme: Use __func__ macro in place of function name
PATCH 1/1 nvme: Use __func__ macro in place of function name
Function nvme_keep_alive_end_io() refers to itself in in a call to dev_err(). It does so using the actual function name in the error message. This should be replaced by a call to the __func__ macro. Using the macro will prevent future potential risk of the function name changing and failure to change the associated error message. This issue was exposed by checkpatch.pl.
--- drivers/nvme/host/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/nvme/host/core.c +1 -2
@@ -784,8 +784,7 @@ static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status)if (status) {dev_err (ctrl->device, -"failed nvme_keep_alive_end_io error=%d\n" , - status); +"failed %s error=%d\n" , __func__, status);return ; }
Signature · 1 line
2.7.5
PATCH 1/1 nvme: Use __func__ macro in place of function name
drivers/nvme/host/core.c static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status) · line 787
Quoted 4 lines · John Pittman
drivers/nvme/host/core.c +1
-2dev_err (ctrl->device, -"failed nvme_keep_alive_end_io error=%d\n" , - status); +"failed %s error=%d\n" , __func__, status);
how about:
dev_err(ctrl->device, "failed to send nvme keepalive %d\n", status);
as the function name isn't really needed for the error description at all and barely transports any information to the user.
Byte,
Johannes
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
PATCH 1/1 nvme: Use __func__ macro in place of function name
Sure Johannes. Sounds good to me!
Quoted 23 lines · Johannes Thumshirn
drivers/nvme/host/core.c static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status) · line 787
Quoted 4 lines · John Pittman
dev_err(ctrl->device,drivers/nvme/host/core.c +1
-2-"failed nvme_keep_alive_end_io error=%d\n" , - status); + "failed %s error=%d\n", __func__, status);how about:
dev_err(ctrl->device, "failed to send nvme keepalive %d\n", status);as the function name isn't really needed for the error description at all and barely transports any information to the user.
Byte,
Johannes--
Johannes Thumshirn Storage
jthumshirn at suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850