lkml.org 
[lkml]   [2019]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usb: sierra: fix a missing check of device_create_file
Date
device_create_file() could fail and return an error code. The fix
captures the error and returns the error code upstream in case it
indeed failed.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/usb/storage/sierra_ms.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c
index 6ac60abd2e15..2c049e3a56eb 100644
--- a/drivers/usb/storage/sierra_ms.c
+++ b/drivers/usb/storage/sierra_ms.c
@@ -195,6 +195,10 @@ int sierra_ms_init(struct us_data *us)
}
complete:
result = device_create_file(&us->pusb_intf->dev, &dev_attr_truinst);
+ if (result) {
+ kfree(swocInfo);
+ return result;
+ }

return 0;
}
--
2.17.1
\
 
 \ /
  Last update: 2019-03-24 23:40    [W:0.049 / U:15.944 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site