usb: otg: tegra: using sscanf in enable_host store functionality
Venu Byravarasu [Fri, 1 Jun 2012 09:48:47 +0000 (14:48 +0530)]
Replaced kstrtoul with sscanf.

Change-Id: I1c82e92bf43d2ceba6ac3a7c0090394ba3497f13
Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Reviewed-on: http://git-master/r/105888
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

drivers/usb/otg/tegra-otg.c

index f91a8f8..2719a62 100644 (file)
@@ -366,10 +366,8 @@ static ssize_t store_host_en(struct device *dev, struct device_attribute *attr,
        unsigned long host;
        int err;
 
-       err = kstrtoul(buf, 10, &host);
-       if (err < 0) {
-               return err;
-       }
+       if (sscanf(buf, "%d", &host) != 1 || host < 0 || host > 1)
+               return -EINVAL;
 
        if (host) {
                enable_interrupt(tegra, false);