usb: otg: tegra: fix coverity issue
Sri Krishna chowdary [Sun, 14 Oct 2012 06:41:20 +0000 (11:41 +0530)]
sscanf reads int into host and host is checked
if it is less than 0. This suggests that host should
be int rather than unsigned int.

Bug 1046331

Change-Id: I8ac4d8113b0602625e2a5019f70f29797148ec5d
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/144373
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

drivers/usb/otg/tegra-otg.c

index 89ee472..3579d48 100644 (file)
@@ -360,7 +360,7 @@ static ssize_t store_host_en(struct device *dev, struct device_attribute *attr,
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct tegra_otg_data *tegra = platform_get_drvdata(pdev);
-       unsigned int host;
+       int host;
 
        if (sscanf(buf, "%d", &host) != 1 || host < 0 || host > 1)
                return -EINVAL;