Re: [kbuild] [platform-drivers-x86:testing 8/8] drivers/platform/x86/toshiba_acpi.c:1352 toshiba_touchpad_store() warn: was intended here instead of ||?

2014-09-10 Thread Dan Carpenter
On Wed, Sep 10, 2014 at 07:59:17AM -0700, Darren Hart wrote:
 On 9/10/14, 0:12, Dan Carpenter dan.carpen...@oracle.com wrote:
 
 tree:   
 git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
 testing
 head:   58e642de0a6fba870c2bba86f3e92c68df1fd42e
 commit: 58e642de0a6fba870c2bba86f3e92c68df1fd42e [8/8] toshiba_acpi:
 Change touchpad store to check for invalid values
 
 drivers/platform/x86/toshiba_acpi.c:1352 toshiba_touchpad_store() warn:
 was  intended here instead of ||?
 
 Fengguang,
 
 What is this checking for? It was supposed to be a ||, but I'm wondering
 what triggered this report?
 

Look again carefully.  ;)  It was supposed to be .  The current code
always returns -EINVAL.

But the warning message is poor...

 58e642de0 Azael Avalos 2014-09-05 @1352  if (state != 0 || state != 1)
 58e642de0 Azael Avalos 2014-09-05  1353  return -EINVAL;

regards,
dan carpenter
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


Re: [kbuild] [platform-drivers-x86:testing 8/8] drivers/platform/x86/toshiba_acpi.c:1352 toshiba_touchpad_store() warn: was intended here instead of ||?

2014-09-10 Thread Fengguang Wu
On Wed, Sep 10, 2014 at 07:59:17AM -0700, Darren Hart wrote:
 On 9/10/14, 0:12, Dan Carpenter dan.carpen...@oracle.com wrote:
 
 tree:   
 git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
 testing
 head:   58e642de0a6fba870c2bba86f3e92c68df1fd42e
 commit: 58e642de0a6fba870c2bba86f3e92c68df1fd42e [8/8] toshiba_acpi:
 Change touchpad store to check for invalid values
 
 drivers/platform/x86/toshiba_acpi.c:1352 toshiba_touchpad_store() warn:
 was  intended here instead of ||?
 
 Fengguang,
 
 What is this checking for? It was supposed to be a ||, but I'm wondering
 what triggered this report?

It looks like an smatch warning. The reason should be, this || test
combination is always true:

(state != 0 || state != 1)

Thanks,
Fengguang

 git remote add platform-drivers-x86
 git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
 git remote update platform-drivers-x86
 git checkout 58e642de0a6fba870c2bba86f3e92c68df1fd42e
 vim +1352 drivers/platform/x86/toshiba_acpi.c
 
 360f0f39d Azael Avalos 2014-03-25  1336
 360f0f39d Azael Avalos 2014-03-25  1337  return sprintf(buf, %i\n,
 time  HCI_MISC_SHIFT);
 360f0f39d Azael Avalos 2014-03-25  1338  }
 360f0f39d Azael Avalos 2014-03-25  1339
 9d8658acd Azael Avalos 2014-03-25  1340  static ssize_t
 toshiba_touchpad_store(struct device *dev,
 9d8658acd Azael Avalos 2014-03-25  1341
 struct
 device_attribute *attr,
 9d8658acd Azael Avalos 2014-03-25  1342
 const char *buf,
 size_t count)
 9d8658acd Azael Avalos 2014-03-25  1343  {
 9d8658acd Azael Avalos 2014-03-25  1344  struct toshiba_acpi_dev
 *toshiba = dev_get_drvdata(dev);
 9d8658acd Azael Avalos 2014-03-25  1345  int state;
 58e642de0 Azael Avalos 2014-09-05  1346  int ret;
 9d8658acd Azael Avalos 2014-03-25  1347
 9d8658acd Azael Avalos 2014-03-25  1348  /* Set the TouchPad on/off, 0 -
 Disable | 1 - Enable */
 58e642de0 Azael Avalos 2014-09-05  1349  ret = kstrtoint(buf, 0, state);
 58e642de0 Azael Avalos 2014-09-05  1350  if (ret)
 58e642de0 Azael Avalos 2014-09-05  1351  return ret;
 58e642de0 Azael Avalos 2014-09-05 @1352  if (state != 0 || state != 1)
 58e642de0 Azael Avalos 2014-09-05  1353  return -EINVAL;
 58e642de0 Azael Avalos 2014-09-05  1354
 58e642de0 Azael Avalos 2014-09-05  1355  ret =
 toshiba_touchpad_set(toshiba, state);
 58e642de0 Azael Avalos 2014-09-05  1356  if (ret)
 58e642de0 Azael Avalos 2014-09-05  1357  return ret;
 9d8658acd Azael Avalos 2014-03-25  1358
 9d8658acd Azael Avalos 2014-03-25  1359  return count;
 9d8658acd Azael Avalos 2014-03-25  1360  }
 
 ---
 0-DAY kernel build testing backend  Open Source Technology
 Center
 http://lists.01.org/mailman/listinfo/kbuild Intel
 Corporation
 
 
 
 -- 
 Darren Hart   Open Source Technology Center
 darren.h...@intel.com Intel Corporation
 
 
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [platform-drivers-x86:testing 8/8] drivers/platform/x86/toshiba_acpi.c:1352 toshiba_touchpad_store() warn: was intended here instead of ||?

2014-09-09 Thread kbuild test robot
TO: Azael Avalos coproscef...@gmail.com
CC: Darren Hart dvh...@linux.intel.com

tree:   git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git 
testing
head:   58e642de0a6fba870c2bba86f3e92c68df1fd42e
commit: 58e642de0a6fba870c2bba86f3e92c68df1fd42e [8/8] toshiba_acpi: Change 
touchpad store to check for invalid values
:: branch date: 37 minutes ago
:: commit date: 37 minutes ago

drivers/platform/x86/toshiba_acpi.c:1352 toshiba_touchpad_store() warn: was  
intended here instead of ||?

git remote add platform-drivers-x86 
git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
git remote update platform-drivers-x86
git checkout 58e642de0a6fba870c2bba86f3e92c68df1fd42e
vim +1352 drivers/platform/x86/toshiba_acpi.c

360f0f39d Azael Avalos 2014-03-25  1336  
360f0f39d Azael Avalos 2014-03-25  1337 return sprintf(buf, %i\n, 
time  HCI_MISC_SHIFT);
360f0f39d Azael Avalos 2014-03-25  1338  }
360f0f39d Azael Avalos 2014-03-25  1339  
9d8658acd Azael Avalos 2014-03-25  1340  static ssize_t 
toshiba_touchpad_store(struct device *dev,
9d8658acd Azael Avalos 2014-03-25  1341   
struct device_attribute *attr,
9d8658acd Azael Avalos 2014-03-25  1342   
const char *buf, size_t count)
9d8658acd Azael Avalos 2014-03-25  1343  {
9d8658acd Azael Avalos 2014-03-25  1344 struct toshiba_acpi_dev 
*toshiba = dev_get_drvdata(dev);
9d8658acd Azael Avalos 2014-03-25  1345 int state;
58e642de0 Azael Avalos 2014-09-05  1346 int ret;
9d8658acd Azael Avalos 2014-03-25  1347  
9d8658acd Azael Avalos 2014-03-25  1348 /* Set the TouchPad on/off, 0 - 
Disable | 1 - Enable */
58e642de0 Azael Avalos 2014-09-05  1349 ret = kstrtoint(buf, 0, state);
58e642de0 Azael Avalos 2014-09-05  1350 if (ret)
58e642de0 Azael Avalos 2014-09-05  1351 return ret;
58e642de0 Azael Avalos 2014-09-05 @1352 if (state != 0 || state != 1)
58e642de0 Azael Avalos 2014-09-05  1353 return -EINVAL;
58e642de0 Azael Avalos 2014-09-05  1354  
58e642de0 Azael Avalos 2014-09-05  1355 ret = 
toshiba_touchpad_set(toshiba, state);
58e642de0 Azael Avalos 2014-09-05  1356 if (ret)
58e642de0 Azael Avalos 2014-09-05  1357 return ret;
9d8658acd Azael Avalos 2014-03-25  1358  
9d8658acd Azael Avalos 2014-03-25  1359 return count;
9d8658acd Azael Avalos 2014-03-25  1360  }

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild