]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: gadget: f_mass_storage: Rework do_request_sense slightly
authorTom Rini <trini@konsulko.com>
Wed, 5 Apr 2023 23:48:57 +0000 (19:48 -0400)
committerTom Rini <trini@konsulko.com>
Tue, 25 Apr 2023 19:31:27 +0000 (15:31 -0400)
When building with clang, it notes that sdinfo may be unused
uninitialized in some cases. This appears to be true from reading the
code, and we can simply set the variable to zero to start with and be as
correct as before.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>
drivers/usb/gadget/f_mass_storage.c

index 45f0504b6e8a4af259eccf1d97f534832496e289..f46829eb7adb295ee7a3cfc73ac583b6f6a3a46d 100644 (file)
@@ -1117,7 +1117,7 @@ static int do_request_sense(struct fsg_common *common, struct fsg_buffhd *bh)
 {
        struct fsg_lun  *curlun = &common->luns[common->lun];
        u8              *buf = (u8 *) bh->buf;
-       u32             sd, sdinfo;
+       u32             sd, sdinfo = 0;
        int             valid;
 
        /*
@@ -1145,7 +1145,6 @@ static int do_request_sense(struct fsg_common *common, struct fsg_buffhd *bh)
        if (!curlun) {          /* Unsupported LUNs are okay */
                common->bad_lun_okay = 1;
                sd = SS_LOGICAL_UNIT_NOT_SUPPORTED;
-               sdinfo = 0;
                valid = 0;
        } else {
                sd = curlun->sense_data;