lkml.org 
[lkml]   [2019]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: sierra: fix a missing check of device_create_file
Hi Kangjie,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.1-rc2 next-20190322]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Kangjie-Lu/usb-sierra-fix-a-missing-check-of-device_create_file/20190325-101328
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-x009-201912 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

drivers/usb/storage/sierra_ms.c: In function 'sierra_ms_init':
>> drivers/usb/storage/sierra_ms.c:199:3: warning: 'swocInfo' may be used uninitialized in this function [-Wmaybe-uninitialized]
kfree(swocInfo);
^~~~~~~~~~~~~~~

vim +/swocInfo +199 drivers/usb/storage/sierra_ms.c

126
127 int sierra_ms_init(struct us_data *us)
128 {
129 int result, retries;
130 struct swoc_info *swocInfo;
131 struct usb_device *udev;
132 struct Scsi_Host *sh;
133
134 retries = 3;
135 result = 0;
136 udev = us->pusb_dev;
137
138 sh = us_to_host(us);
139 scsi_get_host_dev(sh);
140
141 /* Force Modem mode */
142 if (swi_tru_install == TRU_FORCE_MODEM) {
143 usb_stor_dbg(us, "SWIMS: Forcing Modem Mode\n");
144 result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
145 if (result < 0)
146 usb_stor_dbg(us, "SWIMS: Failed to switch to modem mode\n");
147 return -EIO;
148 }
149 /* Force Mass Storage mode (keep CD-Rom) */
150 else if (swi_tru_install == TRU_FORCE_MS) {
151 usb_stor_dbg(us, "SWIMS: Forcing Mass Storage Mode\n");
152 goto complete;
153 }
154 /* Normal TRU-Install Logic */
155 else {
156 usb_stor_dbg(us, "SWIMS: Normal SWoC Logic\n");
157
158 swocInfo = kmalloc(sizeof(struct swoc_info),
159 GFP_KERNEL);
160 if (!swocInfo)
161 return -ENOMEM;
162
163 retries = 3;
164 do {
165 retries--;
166 result = sierra_get_swoc_info(udev, swocInfo);
167 if (result < 0) {
168 usb_stor_dbg(us, "SWIMS: Failed SWoC query\n");
169 schedule_timeout_uninterruptible(2*HZ);
170 }
171 } while (retries && result < 0);
172
173 if (result < 0) {
174 usb_stor_dbg(us, "SWIMS: Completely failed SWoC query\n");
175 kfree(swocInfo);
176 return -EIO;
177 }
178
179 debug_swoc(&us->pusb_dev->dev, swocInfo);
180
181 /*
182 * If there is not Linux software on the TRU-Install device
183 * then switch to modem mode
184 */
185 if (!containsFullLinuxPackage(swocInfo)) {
186 usb_stor_dbg(us, "SWIMS: Switching to Modem Mode\n");
187 result = sierra_set_ms_mode(udev,
188 SWIMS_SET_MODE_Modem);
189 if (result < 0)
190 usb_stor_dbg(us, "SWIMS: Failed to switch modem\n");
191 kfree(swocInfo);
192 return -EIO;
193 }
194 kfree(swocInfo);
195 }
196 complete:
197 result = device_create_file(&us->pusb_intf->dev, &dev_attr_truinst);
198 if (result) {
> 199 kfree(swocInfo);
200 return result;
201 }
202
203 return 0;
204 }
205

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2019-03-25 03:49    [W:0.062 / U:75.128 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site