|
@@ -457,6 +457,12 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
|
|
if (lflags & ~GPIOHANDLE_REQUEST_VALID_FLAGS)
|
|
if (lflags & ~GPIOHANDLE_REQUEST_VALID_FLAGS)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
+ /* OPEN_DRAIN and OPEN_SOURCE flags only make sense for output mode. */
|
|
|
|
+ if (!(lflags & GPIOHANDLE_REQUEST_OUTPUT) &&
|
|
|
|
+ ((lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN) ||
|
|
|
|
+ (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE)))
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
lh = kzalloc(sizeof(*lh), GFP_KERNEL);
|
|
lh = kzalloc(sizeof(*lh), GFP_KERNEL);
|
|
if (!lh)
|
|
if (!lh)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|