Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
2babc05b
Commit
2babc05b
authored
May 02, 2002
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
USB
cleaned up checking the return value of usb_register_dev()
parent
526e60f8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
9 deletions
+56
-9
drivers/usb/class/printer.c
drivers/usb/class/printer.c
+7
-1
drivers/usb/image/mdc800.c
drivers/usb/image/mdc800.c
+6
-1
drivers/usb/image/scanner.c
drivers/usb/image/scanner.c
+8
-1
drivers/usb/input/hiddev.c
drivers/usb/input/hiddev.c
+7
-1
drivers/usb/media/dabusb.c
drivers/usb/media/dabusb.c
+5
-1
drivers/usb/misc/auerswald.c
drivers/usb/misc/auerswald.c
+7
-1
drivers/usb/misc/brlvger.c
drivers/usb/misc/brlvger.c
+7
-1
drivers/usb/usb-skeleton.c
drivers/usb/usb-skeleton.c
+9
-2
No files found.
drivers/usb/class/printer.c
View file @
2babc05b
...
...
@@ -794,6 +794,7 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
{
struct
usblp
*
usblp
=
0
;
int
protocol
;
int
retval
;
char
name
[
6
];
/* Malloc and start initializing usblp structure so we can use it
...
...
@@ -808,7 +809,12 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
init_waitqueue_head
(
&
usblp
->
wait
);
usblp
->
ifnum
=
ifnum
;
if
(
usb_register_dev
(
&
usblp_driver
,
1
,
&
usblp
->
minor
))
{
retval
=
usb_register_dev
(
&
usblp_driver
,
1
,
&
usblp
->
minor
);
if
(
retval
)
{
if
(
retval
!=
-
ENODEV
)
{
err
(
"Not able to get a minor for this device."
);
goto
abort
;
}
/* Look for a free usblp_table entry on our own. */
while
(
usblp_table
[
usblp
->
minor
])
{
usblp
->
minor
++
;
...
...
drivers/usb/image/mdc800.c
View file @
2babc05b
...
...
@@ -411,6 +411,7 @@ static void* mdc800_usb_probe (struct usb_device *dev ,unsigned int ifnum,
int
i
,
j
;
struct
usb_interface_descriptor
*
intf_desc
;
int
irq_interval
=
0
;
int
retval
;
dbg
(
"(mdc800_usb_probe) called."
);
...
...
@@ -475,7 +476,11 @@ static void* mdc800_usb_probe (struct usb_device *dev ,unsigned int ifnum,
down
(
&
mdc800
->
io_lock
);
usb_register_dev
(
&
mdc800_usb_driver
,
1
,
&
mdc800
->
minor
);
retval
=
usb_register_dev
(
&
mdc800_usb_driver
,
1
,
&
mdc800
->
minor
);
if
(
retval
&&
(
retval
!=
-
ENODEV
))
{
err
(
"Not able to get a minor for this device."
);
return
0
;
}
mdc800
->
dev
=
dev
;
mdc800
->
open
=
0
;
...
...
drivers/usb/image/scanner.c
View file @
2babc05b
...
...
@@ -812,6 +812,7 @@ probe_scanner(struct usb_device *dev, unsigned int ifnum,
int
ep_cnt
;
int
ix
;
int
scn_minor
;
int
retval
;
char
valid_device
=
0
;
char
have_bulk_in
,
have_bulk_out
,
have_intr
;
...
...
@@ -953,7 +954,13 @@ probe_scanner(struct usb_device *dev, unsigned int ifnum,
down
(
&
scn_mutex
);
if
(
usb_register_dev
(
&
scanner_driver
,
1
,
&
scn_minor
))
{
retval
=
usb_register_dev
(
&
scanner_driver
,
1
,
&
scn_minor
);
if
(
retval
)
{
if
(
retval
!=
-
ENODEV
)
{
err
(
"Not able to get a minor for this device."
);
up
(
&
scn_mutex
);
return
NULL
;
}
for
(
scn_minor
=
0
;
scn_minor
<
SCN_MAX_MNR
;
scn_minor
++
)
{
if
(
!
p_scn_table
[
scn_minor
])
break
;
...
...
drivers/usb/input/hiddev.c
View file @
2babc05b
...
...
@@ -606,6 +606,7 @@ int hiddev_connect(struct hid_device *hid)
{
struct
hiddev
*
hiddev
;
int
minor
,
i
;
int
retval
;
char
devfs_name
[
16
];
for
(
i
=
0
;
i
<
hid
->
maxapplication
;
i
++
)
...
...
@@ -615,7 +616,12 @@ int hiddev_connect(struct hid_device *hid)
if
(
i
==
hid
->
maxapplication
)
return
-
1
;
if
(
usb_register_dev
(
&
hiddev_driver
,
1
,
&
minor
))
{
retval
=
usb_register_dev
(
&
hiddev_driver
,
1
,
&
minor
);
if
(
retval
)
{
if
(
retval
!=
-
ENODEV
)
{
err
(
"Not able to get a minor for this device."
);
return
-
1
;
}
for
(
minor
=
0
;
minor
<
HIDDEV_MINORS
&&
hiddev_table
[
minor
];
minor
++
);
if
(
minor
==
HIDDEV_MINORS
)
{
printk
(
KERN_ERR
"hiddev: no more free hiddev devices
\n
"
);
...
...
drivers/usb/media/dabusb.c
View file @
2babc05b
...
...
@@ -727,6 +727,7 @@ static void *dabusb_probe (struct usb_device *usbdev, unsigned int ifnum,
const
struct
usb_device_id
*
id
)
{
int
devnum
;
int
retval
;
pdabusb_t
s
;
dbg
(
"dabusb: probe: vendor id 0x%x, device id 0x%x ifnum:%d"
,
...
...
@@ -739,7 +740,10 @@ static void *dabusb_probe (struct usb_device *usbdev, unsigned int ifnum,
if
(
ifnum
!=
_DABUSB_IF
&&
usbdev
->
descriptor
.
idProduct
==
0x9999
)
return
NULL
;
if
(
usb_register_dev
(
&
dabusb_driver
,
1
,
&
devnum
))
{
retval
=
usb_register_dev
(
&
dabusb_driver
,
1
,
&
devnum
);
if
(
retval
)
{
if
(
retval
!=
-
ENODEV
)
return
NULL
;
devnum
=
dabusb_find_struct
();
if
(
devnum
==
-
1
)
return
NULL
;
...
...
drivers/usb/misc/auerswald.c
View file @
2babc05b
...
...
@@ -1948,7 +1948,13 @@ static void *auerswald_probe (struct usb_device *usbdev, unsigned int ifnum,
init_waitqueue_head
(
&
cp
->
bufferwait
);
down
(
&
dev_table_mutex
);
if
(
usb_register_dev
(
&
auerswald_driver
,
1
,
&
dtindex
))
{
ret
=
usb_register_dev
(
&
auerswald_driver
,
1
,
&
dtindex
);
if
(
ret
)
{
if
(
ret
!=
-
ENODEV
)
{
err
(
"Not able to get a minor for this device."
);
up
(
&
dev_table_mutex
);
goto
pfail
;
}
/* find a free slot in the device table */
for
(
dtindex
=
0
;
dtindex
<
AUER_MAX_DEVICES
;
++
dtindex
)
{
if
(
dev_table
[
dtindex
]
==
NULL
)
...
...
drivers/usb/misc/brlvger.c
View file @
2babc05b
...
...
@@ -290,6 +290,7 @@ brlvger_probe (struct usb_device *dev, unsigned ifnum,
{
struct
brlvger_priv
*
priv
=
NULL
;
int
i
;
int
retval
;
struct
usb_endpoint_descriptor
*
endpoint
;
struct
usb_interface_descriptor
*
actifsettings
;
/* protects against reentrance: once we've found a free slot
...
...
@@ -315,7 +316,12 @@ brlvger_probe (struct usb_device *dev, unsigned ifnum,
down
(
&
reserve_sem
);
if
(
usb_register_dev
(
&
brlvger_driver
,
1
,
&
i
))
{
retval
=
usb_register_dev
(
&
brlvger_driver
,
1
,
&
i
);
if
(
retval
)
{
if
(
retval
!=
-
ENODEV
)
{
err
(
"Not able to get a minor for this device."
);
goto
error
;
}
for
(
i
=
0
;
i
<
MAX_NR_BRLVGER_DEVS
;
i
++
)
if
(
display_table
[
i
]
==
NULL
)
break
;
...
...
drivers/usb/usb-skeleton.c
View file @
2babc05b
...
...
@@ -525,6 +525,7 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
int
minor
;
int
buffer_size
;
int
i
;
int
retval
;
char
name
[
10
];
...
...
@@ -535,14 +536,20 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
}
down
(
&
minor_table_mutex
);
if
(
usb_register_dev
(
&
skel_driver
,
1
,
&
minor
))
{
retval
=
usb_register_dev
(
&
skel_driver
,
1
,
&
minor
);
if
(
retval
)
{
if
(
retval
!=
-
ENODEV
)
{
/* something prevented us from registering this driver */
err
(
"Not able to get a minor for this device."
);
goto
exit
;
}
/* we could not get a dynamic minor, so lets find one of our own */
for
(
minor
=
0
;
minor
<
MAX_DEVICES
;
++
minor
)
{
if
(
minor_table
[
minor
]
==
NULL
)
break
;
}
if
(
minor
>=
MAX_DEVICES
)
{
info
(
"Too many devices plugged in, can not handle this device."
);
err
(
"Too many devices plugged in, can not handle this device."
);
goto
exit
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment