gpio: mockup: refuse to accept an odd number of GPIO ranges
Currently we ignore the last odd range value, since each chip is described by two values. Be more strict and require the user to pass an even number of ranges. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
		
							parent
							
								
									650b57b083
								
							
						
					
					
						commit
						b6c2e77d34
					
				| @ -334,7 +334,7 @@ static int gpio_mockup_probe(struct platform_device *pdev) | ||||
| 	int ret, i, base, ngpio; | ||||
| 	char *chip_name; | ||||
| 
 | ||||
| 	if (gpio_mockup_params_nr < 2) | ||||
| 	if (gpio_mockup_params_nr < 2 || (gpio_mockup_params_nr % 2)) | ||||
| 		return -EINVAL; | ||||
| 
 | ||||
| 	chips = devm_kzalloc(dev, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user