]> Git Repo - linux.git/commitdiff
nvme-fcloop: avoid possible uninitialized variable warning
authorJames Smart <[email protected]>
Thu, 21 Dec 2017 22:15:47 +0000 (14:15 -0800)
committerChristoph Hellwig <[email protected]>
Fri, 29 Dec 2017 09:37:21 +0000 (10:37 +0100)
The kbuild test robot send mail of a potential use of an uninitialized
variable - "tport" in fcloop_delete_targetport() which then calls
__targetport_unreg() which uses the variable. It will never be the
case it is uninitialized as the call to __targetport_unreg() only
occurs if there is a valid nport pointer. And at the time the nport
pointer is assigned, the tport variable is set.

Remove the warning by assigning a NULL value initially.

Signed-off-by: James Smart <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
drivers/nvme/target/fcloop.c

index 7b75d9de55ab0d33939bf314a81ee01e26a6d1b1..6a018a0bd6ce851306dd82e5c21e680c626f99d5 100644 (file)
@@ -1085,7 +1085,7 @@ fcloop_delete_target_port(struct device *dev, struct device_attribute *attr,
                const char *buf, size_t count)
 {
        struct fcloop_nport *nport = NULL, *tmpport;
-       struct fcloop_tport *tport;
+       struct fcloop_tport *tport = NULL;
        u64 nodename, portname;
        unsigned long flags;
        int ret;
This page took 0.049085 seconds and 4 git commands to generate.