forked from mirrors/linux
		
	usb: core: bail out if user gives an unknown RefId when using new_id
If users use the new RefId feature of new_id, give them an error message if they provided an unknown reference. That helps detecting typos. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
		
							parent
							
								
									2fc82c2de6
								
							
						
					
					
						commit
						52a6966c35
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
					@ -74,10 +74,13 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
 | 
				
			||||||
		const struct usb_device_id *id = id_table;
 | 
							const struct usb_device_id *id = id_table;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (; id->match_flags; id++)
 | 
							for (; id->match_flags; id++)
 | 
				
			||||||
			if (id->idVendor == refVendor && id->idProduct == refProduct) {
 | 
								if (id->idVendor == refVendor && id->idProduct == refProduct)
 | 
				
			||||||
				dynid->id.driver_info = id->driver_info;
 | 
					 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			}
 | 
					
 | 
				
			||||||
 | 
							if (id->match_flags)
 | 
				
			||||||
 | 
								dynid->id.driver_info = id->driver_info;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								return -ENODEV;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&dynids->lock);
 | 
						spin_lock(&dynids->lock);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue