RE: [RESEND PATCH V6 0/6] Add support for privileged mappings

2016-12-03 Thread Sricharan
Hi Robin,

>Hi Sricharan,
>
>On 02/12/16 14:55, Sricharan R wrote:
>> This series is a resend of the V5 that Mitch sent sometime back [2]
>> All the patches are the same and i have just rebased. Not sure why this
>> finally did not make it last time. The last patch in the previous
>> series does not apply now [3], so just redid that. Also Copied the tags
>> that he had from last time as well.
>
>Heh, I was assuming this would be down to me to pick up. Vinod did have
>some complaints last time about the commit message on the PL330 patch -
>I did get as far as rewriting that and reworking onto my SMMU
>changes[1], I just hadn't got round to sending it, so it fell onto the
>"after the next merge window" pile.
>
>I'd give some review comments, but they'd essentially be a diff against
>that branch :)
>

Sure, i did not knew that you were on this already. I can repost with the diff
from your branch taken in or wait for you as well. I am fine with either ways
that you suggest.

I checked the patches against your branch, i see that the changes are,

1) one patch for implementing it for armv7s descriptor
2) Changes on pl330 patch commit logs and
3) One patch for doing the revert on arm-smmuv3 as well.

Regards,
 Sricharan




RE: [RESEND PATCH V6 0/6] Add support for privileged mappings

2016-12-03 Thread Sricharan
Hi Robin,

>Hi Sricharan,
>
>On 02/12/16 14:55, Sricharan R wrote:
>> This series is a resend of the V5 that Mitch sent sometime back [2]
>> All the patches are the same and i have just rebased. Not sure why this
>> finally did not make it last time. The last patch in the previous
>> series does not apply now [3], so just redid that. Also Copied the tags
>> that he had from last time as well.
>
>Heh, I was assuming this would be down to me to pick up. Vinod did have
>some complaints last time about the commit message on the PL330 patch -
>I did get as far as rewriting that and reworking onto my SMMU
>changes[1], I just hadn't got round to sending it, so it fell onto the
>"after the next merge window" pile.
>
>I'd give some review comments, but they'd essentially be a diff against
>that branch :)
>

Sure, i did not knew that you were on this already. I can repost with the diff
from your branch taken in or wait for you as well. I am fine with either ways
that you suggest.

I checked the patches against your branch, i see that the changes are,

1) one patch for implementing it for armv7s descriptor
2) Changes on pl330 patch commit logs and
3) One patch for doing the revert on arm-smmuv3 as well.

Regards,
 Sricharan




Re: [PATCH] x86/kbuild: enable modversions for symbols exported from asm

2016-12-03 Thread Alan Modra
On Fri, Dec 02, 2016 at 11:55:58AM +0100, Arnd Bergmann wrote:
> I have managed to bisect the link failure to a specific binutils
> commit by Alan Modra now:
> 
> d983c8c ("Strip undefined symbols from .symtab")
> 
> went into binutils-2_26 and was reverted in 
> 
> a82e3ef ("Revert "Strip undefined symbols from .symtab"")
> 
> after the release branch for 2.26 was started, so that version
> ended up being fine. However, the 2.27 version never saw the revert
> and causes loadable kernel modules to become unusable when they refer
> to a weak symbol in vmlinux. This works with 2.26 and lower:

See https://sourceware.org/ml/binutils/2016-01/msg00118.html thread
for discussion on why the patch was reverted for 2.26.  At the time I
believed that only the ppc64 kernel was affected, by a weak undefined
"__crc_TOC." disappearing.  Am I correct in thinking that remained
true up until Linus' merge commit 84d69848c9 2016-10-14?

As far as reverting the binutils commit goes, I'm quite willing to do
that if necessary.  You can see how important I think the fix was by
viewing https://sourceware.org/bugzilla/show_bug.cgi?id=4317 and
noticing that the bug was reported in 2007 and didn't see any action
for 8 years..

-- 
Alan Modra
Australia Development Lab, IBM


Re: [PATCH] x86/kbuild: enable modversions for symbols exported from asm

2016-12-03 Thread Alan Modra
On Fri, Dec 02, 2016 at 11:55:58AM +0100, Arnd Bergmann wrote:
> I have managed to bisect the link failure to a specific binutils
> commit by Alan Modra now:
> 
> d983c8c ("Strip undefined symbols from .symtab")
> 
> went into binutils-2_26 and was reverted in 
> 
> a82e3ef ("Revert "Strip undefined symbols from .symtab"")
> 
> after the release branch for 2.26 was started, so that version
> ended up being fine. However, the 2.27 version never saw the revert
> and causes loadable kernel modules to become unusable when they refer
> to a weak symbol in vmlinux. This works with 2.26 and lower:

See https://sourceware.org/ml/binutils/2016-01/msg00118.html thread
for discussion on why the patch was reverted for 2.26.  At the time I
believed that only the ppc64 kernel was affected, by a weak undefined
"__crc_TOC." disappearing.  Am I correct in thinking that remained
true up until Linus' merge commit 84d69848c9 2016-10-14?

As far as reverting the binutils commit goes, I'm quite willing to do
that if necessary.  You can see how important I think the fix was by
viewing https://sourceware.org/bugzilla/show_bug.cgi?id=4317 and
noticing that the bug was reported in 2007 and didn't see any action
for 8 years..

-- 
Alan Modra
Australia Development Lab, IBM


Re: [Intel-wired-lan] [PATCH v2] e1000e: free IRQ regardless of __E1000_DOWN

2016-12-03 Thread Neftin, Sasha
On 12/2/2016 7:02 PM, Baicar, Tyler wrote:
> Hello Sasha,
> 
> Were you able to reproduce this issue?
> 
> Do you have a patch fixing the close function inconsistencies that you
> mentioned which I could try out?
> 
> Thanks,
> Tyler
> 
> On 11/21/2016 1:40 PM, Baicar, Tyler wrote:
>> On 11/17/2016 6:31 AM, Neftin, Sasha wrote:
>>> On 11/13/2016 10:34 AM, Neftin, Sasha wrote:
 On 11/11/2016 12:35 AM, Baicar, Tyler wrote:
> Hello Sasha,
>
> On 11/9/2016 11:19 PM, Neftin, Sasha wrote:
>> On 11/9/2016 11:41 PM, Tyler Baicar wrote:
>>> Move IRQ free code so that it will happen regardless of the
>>> __E1000_DOWN bit. Currently the e1000e driver only releases its IRQ
>>> if the __E1000_DOWN bit is cleared. This is not sufficient because
>>> it is possible for __E1000_DOWN to be set without releasing the IRQ.
>>> In such a situation, we will hit a kernel bug later in e1000_remove
>>> because the IRQ still has action since it was never freed. A
>>> secondary bus reset can cause this case to happen.
>>>
>>> Signed-off-by: Tyler Baicar 
>>> ---
>>>drivers/net/ethernet/intel/e1000e/netdev.c | 3 ++-
>>>1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c
>>> b/drivers/net/ethernet/intel/e1000e/netdev.c
>>> index 7017281..36cfcb0 100644
>>> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
>>> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
>>> @@ -4679,12 +4679,13 @@ int e1000e_close(struct net_device *netdev)
>>>  if (!test_bit(__E1000_DOWN, >state)) {
>>>e1000e_down(adapter, true);
>>> -e1000_free_irq(adapter);
>>>  /* Link status message must follow this format */
>>>pr_info("%s NIC Link is Down\n", adapter->netdev->name);
>>>}
>>>+e1000_free_irq(adapter);
>>> +
>>>napi_disable(>napi);
>>>  e1000e_free_tx_resources(adapter->tx_ring);
>>>
>> I would like not recommend insert this change. This change related
>> driver state machine, we afraid from lot of synchronization
>> problem and
>> issues.
>> We need keep e1000_free_irq in loop and check for 'test_bit' ready.
> What do you mean here? There is no loop. If __E1000_DOWN is set
> then we
> will never free the IRQ.
>
>> Another point, does before execute secondary bus reset your SW
>> back up
>> pcie configuration space as properly?
> After a secondary bus reset, the link needs to recover and go back
> to a
> working state after 1 second.
>
>  From the callstack, the issue is happening while removing the
> endpoint
> from the system, before applying the secondary bus reset.
>
> The order of events is
> 1. remove the drivers
> 2. cause a secondary bus reset
> 3. wait 1 second
 Actually, this is too much, usually link up in less than 100ms.You can
 check Data Link Layer indication.
> 4. recover the link
>
> callstack:
> free_msi_irqs+0x6c/0x1a8
> pci_disable_msi+0xb0/0x148
> e1000e_reset_interrupt_capability+0x60/0x78
> e1000_remove+0xc8/0x180
> pci_device_remove+0x48/0x118
> __device_release_driver+0x80/0x108
> device_release_driver+0x2c/0x40
> pci_stop_bus_device+0xa0/0xb0
> pci_stop_bus_device+0x3c/0xb0
> pci_stop_root_bus+0x54/0x80
> acpi_pci_root_remove+0x28/0x64
> acpi_bus_trim+0x6c/0xa4
> acpi_device_hotplug+0x19c/0x3f4
> acpi_hotplug_work_fn+0x28/0x3c
> process_one_work+0x150/0x460
> worker_thread+0x50/0x4b8
> kthread+0xd4/0xe8
> ret_from_fork+0x10/0x50
>
> Thanks,
> Tyler
>
 Hello Tyler,
 Okay, we need consult more about this suggestion.
 May I ask what is setup you run? Is there NIC or on board LAN? I would
 like try reproduce this issue in our lab's too.
 Also, is same issue observed with same scenario and others NIC's too?
 Sasha
 ___
 Intel-wired-lan mailing list
 intel-wired-...@lists.osuosl.org
 http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

>>> Hello Tyler,
>>> I see some in consistent implementation of __*_close methods in our
>>> drivers. Do you have any igb NIC to check if same problem persist there?
>>> Thanks,
>>> Sasha
>> Hello Sasha,
>>
>> I couldn't find an igb NIC to test with, but I did find another e1000e
>> card that does not cause the same issue. That card is:
>>
>> 0004:01:00.0 Ethernet controller: Intel Corporation 82574L Gigabit
>> Network Connection
>> Subsystem: Intel Corporation Gigabit CT Desktop Adapter
>> Physical Slot: 5-1
>> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
>> ParErr- Stepping- SERR+ FastB2B- DisINTx+
>> Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast 

Re: [Intel-wired-lan] [PATCH v2] e1000e: free IRQ regardless of __E1000_DOWN

2016-12-03 Thread Neftin, Sasha
On 12/2/2016 7:02 PM, Baicar, Tyler wrote:
> Hello Sasha,
> 
> Were you able to reproduce this issue?
> 
> Do you have a patch fixing the close function inconsistencies that you
> mentioned which I could try out?
> 
> Thanks,
> Tyler
> 
> On 11/21/2016 1:40 PM, Baicar, Tyler wrote:
>> On 11/17/2016 6:31 AM, Neftin, Sasha wrote:
>>> On 11/13/2016 10:34 AM, Neftin, Sasha wrote:
 On 11/11/2016 12:35 AM, Baicar, Tyler wrote:
> Hello Sasha,
>
> On 11/9/2016 11:19 PM, Neftin, Sasha wrote:
>> On 11/9/2016 11:41 PM, Tyler Baicar wrote:
>>> Move IRQ free code so that it will happen regardless of the
>>> __E1000_DOWN bit. Currently the e1000e driver only releases its IRQ
>>> if the __E1000_DOWN bit is cleared. This is not sufficient because
>>> it is possible for __E1000_DOWN to be set without releasing the IRQ.
>>> In such a situation, we will hit a kernel bug later in e1000_remove
>>> because the IRQ still has action since it was never freed. A
>>> secondary bus reset can cause this case to happen.
>>>
>>> Signed-off-by: Tyler Baicar 
>>> ---
>>>drivers/net/ethernet/intel/e1000e/netdev.c | 3 ++-
>>>1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c
>>> b/drivers/net/ethernet/intel/e1000e/netdev.c
>>> index 7017281..36cfcb0 100644
>>> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
>>> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
>>> @@ -4679,12 +4679,13 @@ int e1000e_close(struct net_device *netdev)
>>>  if (!test_bit(__E1000_DOWN, >state)) {
>>>e1000e_down(adapter, true);
>>> -e1000_free_irq(adapter);
>>>  /* Link status message must follow this format */
>>>pr_info("%s NIC Link is Down\n", adapter->netdev->name);
>>>}
>>>+e1000_free_irq(adapter);
>>> +
>>>napi_disable(>napi);
>>>  e1000e_free_tx_resources(adapter->tx_ring);
>>>
>> I would like not recommend insert this change. This change related
>> driver state machine, we afraid from lot of synchronization
>> problem and
>> issues.
>> We need keep e1000_free_irq in loop and check for 'test_bit' ready.
> What do you mean here? There is no loop. If __E1000_DOWN is set
> then we
> will never free the IRQ.
>
>> Another point, does before execute secondary bus reset your SW
>> back up
>> pcie configuration space as properly?
> After a secondary bus reset, the link needs to recover and go back
> to a
> working state after 1 second.
>
>  From the callstack, the issue is happening while removing the
> endpoint
> from the system, before applying the secondary bus reset.
>
> The order of events is
> 1. remove the drivers
> 2. cause a secondary bus reset
> 3. wait 1 second
 Actually, this is too much, usually link up in less than 100ms.You can
 check Data Link Layer indication.
> 4. recover the link
>
> callstack:
> free_msi_irqs+0x6c/0x1a8
> pci_disable_msi+0xb0/0x148
> e1000e_reset_interrupt_capability+0x60/0x78
> e1000_remove+0xc8/0x180
> pci_device_remove+0x48/0x118
> __device_release_driver+0x80/0x108
> device_release_driver+0x2c/0x40
> pci_stop_bus_device+0xa0/0xb0
> pci_stop_bus_device+0x3c/0xb0
> pci_stop_root_bus+0x54/0x80
> acpi_pci_root_remove+0x28/0x64
> acpi_bus_trim+0x6c/0xa4
> acpi_device_hotplug+0x19c/0x3f4
> acpi_hotplug_work_fn+0x28/0x3c
> process_one_work+0x150/0x460
> worker_thread+0x50/0x4b8
> kthread+0xd4/0xe8
> ret_from_fork+0x10/0x50
>
> Thanks,
> Tyler
>
 Hello Tyler,
 Okay, we need consult more about this suggestion.
 May I ask what is setup you run? Is there NIC or on board LAN? I would
 like try reproduce this issue in our lab's too.
 Also, is same issue observed with same scenario and others NIC's too?
 Sasha
 ___
 Intel-wired-lan mailing list
 intel-wired-...@lists.osuosl.org
 http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

>>> Hello Tyler,
>>> I see some in consistent implementation of __*_close methods in our
>>> drivers. Do you have any igb NIC to check if same problem persist there?
>>> Thanks,
>>> Sasha
>> Hello Sasha,
>>
>> I couldn't find an igb NIC to test with, but I did find another e1000e
>> card that does not cause the same issue. That card is:
>>
>> 0004:01:00.0 Ethernet controller: Intel Corporation 82574L Gigabit
>> Network Connection
>> Subsystem: Intel Corporation Gigabit CT Desktop Adapter
>> Physical Slot: 5-1
>> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
>> ParErr- Stepping- SERR+ FastB2B- DisINTx+
>> Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
>> SERR- > 

Re: [PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Leon Romanovsky
On Sun, Dec 04, 2016 at 02:45:38PM +0800, Pan Bian wrote:
> From: Pan Bian 
>
> If uhw->inlen is non-zero, the value of variable err is 0 if the copy
> succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it
> will return 0 to the callers. As a result, the callers cannot detect the
> errors. This patch fixes the bug, assign "-ENOMEM" to err before the
> NULL pointer checks, and remove the initialization of err at the
> beginning.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189031
> Signed-off-by: Pan Bian 

Thanks,
Reviewed-by: Leon Romanovsky 


signature.asc
Description: PGP signature


Re: [PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Leon Romanovsky
On Sun, Dec 04, 2016 at 02:45:38PM +0800, Pan Bian wrote:
> From: Pan Bian 
>
> If uhw->inlen is non-zero, the value of variable err is 0 if the copy
> succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it
> will return 0 to the callers. As a result, the callers cannot detect the
> errors. This patch fixes the bug, assign "-ENOMEM" to err before the
> NULL pointer checks, and remove the initialization of err at the
> beginning.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189031
> Signed-off-by: Pan Bian 

Thanks,
Reviewed-by: Leon Romanovsky 


signature.asc
Description: PGP signature


[PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

If uhw->inlen is non-zero, the value of variable err is 0 if the copy
succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it
will return 0 to the callers. As a result, the callers cannot detect the
errors. This patch fixes the bug, assign "-ENOMEM" to err before the
NULL pointer checks, and remove the initialization of err at the
beginning.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189031
Signed-off-by: Pan Bian 
---
 drivers/infiniband/hw/mlx4/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c 
b/drivers/infiniband/hw/mlx4/main.c
index b597e82..a87c395 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -430,7 +430,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
struct mlx4_ib_dev *dev = to_mdev(ibdev);
struct ib_smp *in_mad  = NULL;
struct ib_smp *out_mad = NULL;
-   int err = -ENOMEM;
+   int err;
int have_ib_ports;
struct mlx4_uverbs_ex_query_device cmd;
struct mlx4_uverbs_ex_query_device_resp resp = {.comp_mask = 0};
@@ -455,6 +455,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
sizeof(resp.response_length);
in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
+   err = -ENOMEM;
if (!in_mad || !out_mad)
goto out;
 
-- 
1.9.1




[PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

If uhw->inlen is non-zero, the value of variable err is 0 if the copy
succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it
will return 0 to the callers. As a result, the callers cannot detect the
errors. This patch fixes the bug, assign "-ENOMEM" to err before the
NULL pointer checks, and remove the initialization of err at the
beginning.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189031
Signed-off-by: Pan Bian 
---
 drivers/infiniband/hw/mlx4/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c 
b/drivers/infiniband/hw/mlx4/main.c
index b597e82..a87c395 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -430,7 +430,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
struct mlx4_ib_dev *dev = to_mdev(ibdev);
struct ib_smp *in_mad  = NULL;
struct ib_smp *out_mad = NULL;
-   int err = -ENOMEM;
+   int err;
int have_ib_ports;
struct mlx4_uverbs_ex_query_device cmd;
struct mlx4_uverbs_ex_query_device_resp resp = {.comp_mask = 0};
@@ -455,6 +455,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
sizeof(resp.response_length);
in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
+   err = -ENOMEM;
if (!in_mad || !out_mad)
goto out;
 
-- 
1.9.1




arch/xtensa/include/asm/initialize_mmu.h:41: Error: invalid register 'atomctl' for 'wsr' instruction

2016-12-03 Thread kbuild test robot
Hi Pete,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0cb65c83304a341b9d09678448d7c8b550689531
commit: d0b73b488c55df905ea8faaad079f8535629ed26 xtensa: Add config files for 
Diamond 233L - Rev C processor variant
date:   3 years, 9 months ago
config: xtensa-generic_kc705_defconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout d0b73b488c55df905ea8faaad079f8535629ed26
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   arch/xtensa/include/asm/initialize_mmu.h: Assembler messages:
>> arch/xtensa/include/asm/initialize_mmu.h:41: Error: invalid register 
>> 'atomctl' for 'wsr' instruction

vim +41 arch/xtensa/include/asm/initialize_mmu.h

c622b29d Max Filippov 2012-11-19  25  
c622b29d Max Filippov 2012-11-19  26  #ifdef __ASSEMBLY__
c622b29d Max Filippov 2012-11-19  27  
c622b29d Max Filippov 2012-11-19  28  #define XTENSA_HWVERSION_RC_2009_0 23
c622b29d Max Filippov 2012-11-19  29  
c622b29d Max Filippov 2012-11-19  30.macro  initialize_mmu
c622b29d Max Filippov 2012-11-19  31  
c622b29d Max Filippov 2012-11-19  32  #if XCHAL_HAVE_S32C1I && 
(XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0)
c622b29d Max Filippov 2012-11-19  33  /*
c622b29d Max Filippov 2012-11-19  34   * We Have Atomic Operation Control 
(ATOMCTL) Register; Initialize it.
c622b29d Max Filippov 2012-11-19  35   * For details see 
Documentation/xtensa/atomctl.txt
c622b29d Max Filippov 2012-11-19  36   */
c622b29d Max Filippov 2012-11-19  37  #if XCHAL_DCACHE_IS_COHERENT
c622b29d Max Filippov 2012-11-19  38movia3, 0x25/* For SMP/MX 
-- internal for writeback,
c622b29d Max Filippov 2012-11-19  39 * RCW otherwise
c622b29d Max Filippov 2012-11-19  40 */
c622b29d Max Filippov 2012-11-19 @41  #else
c622b29d Max Filippov 2012-11-19  42movia3, 0x29/* non-MX -- 
Most cores use Std Memory
c622b29d Max Filippov 2012-11-19  43 * Controlers 
which usually can't use RCW
c622b29d Max Filippov 2012-11-19  44 */
c622b29d Max Filippov 2012-11-19  45  #endif
c622b29d Max Filippov 2012-11-19  46wsr a3, atomctl
c622b29d Max Filippov 2012-11-19  47  #endif  /* XCHAL_HAVE_S32C1I &&
c622b29d Max Filippov 2012-11-19  48 * (XCHAL_HW_MIN_VERSION >= 
XTENSA_HWVERSION_RC_2009_0)
c622b29d Max Filippov 2012-11-19  49 */

:: The code at line 41 was first introduced by commit
:: c622b29d1f38021411965b7e0170ab01b257 xtensa: initialize atomctl SR

:: TO: Max Filippov 
:: CC: Chris Zankel 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


arch/xtensa/include/asm/initialize_mmu.h:41: Error: invalid register 'atomctl' for 'wsr' instruction

2016-12-03 Thread kbuild test robot
Hi Pete,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0cb65c83304a341b9d09678448d7c8b550689531
commit: d0b73b488c55df905ea8faaad079f8535629ed26 xtensa: Add config files for 
Diamond 233L - Rev C processor variant
date:   3 years, 9 months ago
config: xtensa-generic_kc705_defconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout d0b73b488c55df905ea8faaad079f8535629ed26
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   arch/xtensa/include/asm/initialize_mmu.h: Assembler messages:
>> arch/xtensa/include/asm/initialize_mmu.h:41: Error: invalid register 
>> 'atomctl' for 'wsr' instruction

vim +41 arch/xtensa/include/asm/initialize_mmu.h

c622b29d Max Filippov 2012-11-19  25  
c622b29d Max Filippov 2012-11-19  26  #ifdef __ASSEMBLY__
c622b29d Max Filippov 2012-11-19  27  
c622b29d Max Filippov 2012-11-19  28  #define XTENSA_HWVERSION_RC_2009_0 23
c622b29d Max Filippov 2012-11-19  29  
c622b29d Max Filippov 2012-11-19  30.macro  initialize_mmu
c622b29d Max Filippov 2012-11-19  31  
c622b29d Max Filippov 2012-11-19  32  #if XCHAL_HAVE_S32C1I && 
(XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0)
c622b29d Max Filippov 2012-11-19  33  /*
c622b29d Max Filippov 2012-11-19  34   * We Have Atomic Operation Control 
(ATOMCTL) Register; Initialize it.
c622b29d Max Filippov 2012-11-19  35   * For details see 
Documentation/xtensa/atomctl.txt
c622b29d Max Filippov 2012-11-19  36   */
c622b29d Max Filippov 2012-11-19  37  #if XCHAL_DCACHE_IS_COHERENT
c622b29d Max Filippov 2012-11-19  38movia3, 0x25/* For SMP/MX 
-- internal for writeback,
c622b29d Max Filippov 2012-11-19  39 * RCW otherwise
c622b29d Max Filippov 2012-11-19  40 */
c622b29d Max Filippov 2012-11-19 @41  #else
c622b29d Max Filippov 2012-11-19  42movia3, 0x29/* non-MX -- 
Most cores use Std Memory
c622b29d Max Filippov 2012-11-19  43 * Controlers 
which usually can't use RCW
c622b29d Max Filippov 2012-11-19  44 */
c622b29d Max Filippov 2012-11-19  45  #endif
c622b29d Max Filippov 2012-11-19  46wsr a3, atomctl
c622b29d Max Filippov 2012-11-19  47  #endif  /* XCHAL_HAVE_S32C1I &&
c622b29d Max Filippov 2012-11-19  48 * (XCHAL_HW_MIN_VERSION >= 
XTENSA_HWVERSION_RC_2009_0)
c622b29d Max Filippov 2012-11-19  49 */

:: The code at line 41 was first introduced by commit
:: c622b29d1f38021411965b7e0170ab01b257 xtensa: initialize atomctl SR

:: TO: Max Filippov 
:: CC: Chris Zankel 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH 1/1] net: ethernet: broadcom: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

Marco BNX2X_ALLOC_AND_SET(arr, lbl, func) calls kmalloc() to allocate
memory, and jumps to label "lbl" if the allocation fails. Label "lbl"
first cleans memory and then returns variable rc. Before calling the
macro, the value of variable rc is 0. Because 0 means no error, the
callers of bnx2x_init_firmware() may be misled. This patch fixes the bug,
assigning "-ENOMEM" to rc before calling macro NX2X_ALLOC_AND_SET().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189141

Signed-off-by: Pan Bian 
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 0cee4c0..6f9fc20 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -13505,6 +13505,7 @@ static int bnx2x_init_firmware(struct bnx2x *bp)
 
/* Initialize the pointers to the init arrays */
/* Blob */
+   rc = -ENOMEM;
BNX2X_ALLOC_AND_SET(init_data, request_firmware_exit, be32_to_cpu_n);
 
/* Opcodes */
-- 
1.9.1




[PATCH 1/1] net: ethernet: broadcom: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

Marco BNX2X_ALLOC_AND_SET(arr, lbl, func) calls kmalloc() to allocate
memory, and jumps to label "lbl" if the allocation fails. Label "lbl"
first cleans memory and then returns variable rc. Before calling the
macro, the value of variable rc is 0. Because 0 means no error, the
callers of bnx2x_init_firmware() may be misled. This patch fixes the bug,
assigning "-ENOMEM" to rc before calling macro NX2X_ALLOC_AND_SET().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189141

Signed-off-by: Pan Bian 
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 0cee4c0..6f9fc20 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -13505,6 +13505,7 @@ static int bnx2x_init_firmware(struct bnx2x *bp)
 
/* Initialize the pointers to the init arrays */
/* Blob */
+   rc = -ENOMEM;
BNX2X_ALLOC_AND_SET(init_data, request_firmware_exit, be32_to_cpu_n);
 
/* Opcodes */
-- 
1.9.1




[PATCH 1/1] xen: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

The return variable rc is initialized with "-ENOMEM" outside the loop.
However, it is reset in the loop, and its value is not negative during 
the second or after repeat of the loop. If kzalloc() fails then, it will 
return 0. This patch fixes the bug, assigning "-ENOMEM" to rc when 
kzalloc() or alloc_page() returns NULL.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189111

Signed-off-by: Pan Bian 
---
 drivers/xen/gntalloc.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c
index 7a47c4c..55ef246 100644
--- a/drivers/xen/gntalloc.c
+++ b/drivers/xen/gntalloc.c
@@ -130,15 +130,19 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op,
rc = -ENOMEM;
for (i = 0; i < op->count; i++) {
gref = kzalloc(sizeof(*gref), GFP_KERNEL);
-   if (!gref)
+   if (!gref) {
+   rc = -ENOMEM;
goto undo;
+   }
list_add_tail(>next_gref, _gref);
list_add_tail(>next_file, _file);
gref->users = 1;
gref->file_index = op->index + i * PAGE_SIZE;
gref->page = alloc_page(GFP_KERNEL|__GFP_ZERO);
-   if (!gref->page)
+   if (!gref->page) {
+   rc = -ENOMEM;
goto undo;
+   }
 
/* Grant foreign access to the page. */
rc = gnttab_grant_foreign_access(op->domid,
-- 
1.9.1




[PATCH 1/1] xen: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

The return variable rc is initialized with "-ENOMEM" outside the loop.
However, it is reset in the loop, and its value is not negative during 
the second or after repeat of the loop. If kzalloc() fails then, it will 
return 0. This patch fixes the bug, assigning "-ENOMEM" to rc when 
kzalloc() or alloc_page() returns NULL.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189111

Signed-off-by: Pan Bian 
---
 drivers/xen/gntalloc.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c
index 7a47c4c..55ef246 100644
--- a/drivers/xen/gntalloc.c
+++ b/drivers/xen/gntalloc.c
@@ -130,15 +130,19 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op,
rc = -ENOMEM;
for (i = 0; i < op->count; i++) {
gref = kzalloc(sizeof(*gref), GFP_KERNEL);
-   if (!gref)
+   if (!gref) {
+   rc = -ENOMEM;
goto undo;
+   }
list_add_tail(>next_gref, _gref);
list_add_tail(>next_file, _file);
gref->users = 1;
gref->file_index = op->index + i * PAGE_SIZE;
gref->page = alloc_page(GFP_KERNEL|__GFP_ZERO);
-   if (!gref->page)
+   if (!gref->page) {
+   rc = -ENOMEM;
goto undo;
+   }
 
/* Grant foreign access to the page. */
rc = gnttab_grant_foreign_access(op->domid,
-- 
1.9.1




Re: [PATCH 1/1] infiniband: hw: ocrdma: fix bad initialization

2016-12-03 Thread Leon Romanovsky
On Sat, Dec 03, 2016 at 09:10:21PM +0800, Pan Bian wrote:
> From: Pan Bian 
>
> In function ocrdma_mbx_create_ah_tbl(), returns the value of status on
> errors. However, because status is initialized with 0, 0 will be
> returned even if on error paths. This patch initialize status with
> "-ENOMEM".
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188831
>
> Signed-off-by: Pan Bian 

Thanks,
Reviewed-by: Leon Romanovsky 


signature.asc
Description: PGP signature


Re: [PATCH 1/1] infiniband: hw: ocrdma: fix bad initialization

2016-12-03 Thread Leon Romanovsky
On Sat, Dec 03, 2016 at 09:10:21PM +0800, Pan Bian wrote:
> From: Pan Bian 
>
> In function ocrdma_mbx_create_ah_tbl(), returns the value of status on
> errors. However, because status is initialized with 0, 0 will be
> returned even if on error paths. This patch initialize status with
> "-ENOMEM".
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188831
>
> Signed-off-by: Pan Bian 

Thanks,
Reviewed-by: Leon Romanovsky 


signature.asc
Description: PGP signature


[PATCH 1/1] mtd: ubi: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When __vmalloc() returns a NULL pointer, the region is not checked, and
we cannot make sure that only 0xFF bytes are present at offset. Thus,
returning 0 seems improper.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189081

Signed-off-by: Pan Bian 
---
 drivers/mtd/ubi/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index b6fb8f9..b54fe05 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -1413,7 +1413,7 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int 
pnum, int offset, int len)
buf = __vmalloc(len, GFP_NOFS, PAGE_KERNEL);
if (!buf) {
ubi_err(ubi, "cannot allocate memory to check for 0xFFs");
-   return 0;
+   return -ENOMEM;
}
 
err = mtd_read(ubi->mtd, addr, len, , buf);
-- 
1.9.1




[PATCH 1/1] mtd: ubi: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When __vmalloc() returns a NULL pointer, the region is not checked, and
we cannot make sure that only 0xFF bytes are present at offset. Thus,
returning 0 seems improper.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189081

Signed-off-by: Pan Bian 
---
 drivers/mtd/ubi/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index b6fb8f9..b54fe05 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -1413,7 +1413,7 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int 
pnum, int offset, int len)
buf = __vmalloc(len, GFP_NOFS, PAGE_KERNEL);
if (!buf) {
ubi_err(ubi, "cannot allocate memory to check for 0xFFs");
-   return 0;
+   return -ENOMEM;
}
 
err = mtd_read(ubi->mtd, addr, len, , buf);
-- 
1.9.1




[PATCH 1/1] net: ethernet: qlogic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the call to qlcnic_alloc_mbx_args() fails, returning variable "err"
seems improper. With reference to the context, returing variable
"config" may be better.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189101

Signed-off-by: Pan Bian 
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index bdbcd2b..21c4aca 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -3189,7 +3189,7 @@ int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter)
 
err = qlcnic_alloc_mbx_args(, adapter, QLCNIC_CMD_GET_LINK_STATUS);
if (err)
-   return err;
+   return config;
 
err = qlcnic_issue_cmd(adapter, );
if (err) {
-- 
1.9.1




Re: [PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Leon Romanovsky
On Sun, Dec 04, 2016 at 01:49:04PM +0800, Pan Bian wrote:
> From: Pan Bian 
>
> If uhw->inlen is non-zero, the value of variable err is 0 if the copy
> succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it
> will return 0 to the callers. As a result, the callers cannot detect the
> errors. This patch fixes the bug, assigning "-ENOMEM" to err before
> the NULL pointer checks.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189031
>
> Signed-off-by: Pan Bian 
> ---
>  drivers/infiniband/hw/mlx4/main.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/hw/mlx4/main.c 
> b/drivers/infiniband/hw/mlx4/main.c
> index b597e82..f6c5158 100644
> --- a/drivers/infiniband/hw/mlx4/main.c
> +++ b/drivers/infiniband/hw/mlx4/main.c
> @@ -455,6 +455,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
>   sizeof(resp.response_length);
>   in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
>   out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
> + err = -ENOMEM;
>   if (!in_mad || !out_mad)
>   goto out;

In such case, the err initialization at the beginning of
mlx4_ib_query_device function is not necessary. Can you please remove it?

Besides that, look good.
Reviewed-by: Leon Romanovsky 

>
> --
> 1.9.1
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


signature.asc
Description: PGP signature


[PATCH 1/1] net: ethernet: qlogic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the call to qlcnic_alloc_mbx_args() fails, returning variable "err"
seems improper. With reference to the context, returing variable
"config" may be better.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189101

Signed-off-by: Pan Bian 
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index bdbcd2b..21c4aca 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -3189,7 +3189,7 @@ int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter)
 
err = qlcnic_alloc_mbx_args(, adapter, QLCNIC_CMD_GET_LINK_STATUS);
if (err)
-   return err;
+   return config;
 
err = qlcnic_issue_cmd(adapter, );
if (err) {
-- 
1.9.1




Re: [PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Leon Romanovsky
On Sun, Dec 04, 2016 at 01:49:04PM +0800, Pan Bian wrote:
> From: Pan Bian 
>
> If uhw->inlen is non-zero, the value of variable err is 0 if the copy
> succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it
> will return 0 to the callers. As a result, the callers cannot detect the
> errors. This patch fixes the bug, assigning "-ENOMEM" to err before
> the NULL pointer checks.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189031
>
> Signed-off-by: Pan Bian 
> ---
>  drivers/infiniband/hw/mlx4/main.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/hw/mlx4/main.c 
> b/drivers/infiniband/hw/mlx4/main.c
> index b597e82..f6c5158 100644
> --- a/drivers/infiniband/hw/mlx4/main.c
> +++ b/drivers/infiniband/hw/mlx4/main.c
> @@ -455,6 +455,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
>   sizeof(resp.response_length);
>   in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
>   out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
> + err = -ENOMEM;
>   if (!in_mad || !out_mad)
>   goto out;

In such case, the err initialization at the beginning of
mlx4_ib_query_device function is not necessary. Can you please remove it?

Besides that, look good.
Reviewed-by: Leon Romanovsky 

>
> --
> 1.9.1
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


signature.asc
Description: PGP signature


[PATCH 1/1] net: ethernet: qlogic: set error code on failure

2016-12-03 Thread Pan Bian
From: Pan Bian 

When calling dma_mapping_error(), the value of return variable rc is 0.
And when the call returns an unexpected value, rc is not set to a
negative errno. Thus, it will return 0 on the error path, and its
callers cannot detect the bug. This patch fixes the bug, assigning
"-ENOMEM" to err.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189041

Signed-off-by: Pan Bian 
---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c 
b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index f95385c..62ae55b 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -1730,6 +1730,7 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, 
struct sk_buff *skb)
   mapping))) {
DP_NOTICE(cdev,
  "Unable to map frag - dropping 
packet\n");
+   rc = -ENOMEM;
goto err;
}
} else {
-- 
1.9.1




[PATCH 1/1] net: ethernet: qlogic: set error code on failure

2016-12-03 Thread Pan Bian
From: Pan Bian 

When calling dma_mapping_error(), the value of return variable rc is 0.
And when the call returns an unexpected value, rc is not set to a
negative errno. Thus, it will return 0 on the error path, and its
callers cannot detect the bug. This patch fixes the bug, assigning
"-ENOMEM" to err.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189041

Signed-off-by: Pan Bian 
---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c 
b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index f95385c..62ae55b 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -1730,6 +1730,7 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, 
struct sk_buff *skb)
   mapping))) {
DP_NOTICE(cdev,
  "Unable to map frag - dropping 
packet\n");
+   rc = -ENOMEM;
goto err;
}
} else {
-- 
1.9.1




Re: [PATCH v3 07/13] net: ethernet: ti: cpts: clean up event list if event pool is empty

2016-12-03 Thread kbuild test robot
Hi WingMan,

[auto build test ERROR on net/master]
[also build test ERROR on v4.9-rc7 next-20161202]
[cannot apply to net-next/master]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Grygorii-Strashko/net-ethernet-ti-cpts-switch-to-readl-writel_relaxed/20161204-010355
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

Note: the 
linux-review/Grygorii-Strashko/net-ethernet-ti-cpts-switch-to-readl-writel_relaxed/20161204-010355
 HEAD f938805dce662197c057c75ac67849f60da87c9f builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

   In file included from include/linux/dma-mapping.h:6:0,
from include/linux/skbuff.h:34,
from include/linux/ip.h:20,
from include/linux/ptp_classify.h:26,
from drivers/net/ethernet/ti/cpts.c:25:
   drivers/net/ethernet/ti/cpts.c: In function 'cpts_purge_events':
>> drivers/net/ethernet/ti/cpts.c:76:15: error: 'struct cpts' has no member 
>> named 'dev'
  dev_dbg(cpts->dev, "cpts: event pool cleaned up %d\n", removed);
  ^
   include/linux/device.h:1209:26: note: in definition of macro 'dev_dbg'
  dev_printk(KERN_DEBUG, dev, format, ##arg); \
 ^~~
   drivers/net/ethernet/ti/cpts.c: In function 'cpts_fifo_read':
   drivers/net/ethernet/ti/cpts.c:94:16: error: 'struct cpts' has no member 
named 'dev'
   dev_err(cpts->dev, "cpts: event pool empty\n");
   ^~

vim +76 drivers/net/ethernet/ti/cpts.c

19   */
20  #include 
21  #include 
22  #include 
23  #include 
24  #include 
  > 25  #include 
26  #include 
27  #include 
28  #include 
29  #include 
30  #include 
31  
32  #include "cpts.h"
33  
34  #define cpts_read32(c, r)   readl_relaxed(>reg->r)
35  #define cpts_write32(c, v, r)   writel_relaxed(v, >reg->r)
36  
37  static int event_expired(struct cpts_event *event)
38  {
39  return time_after(jiffies, event->tmo);
40  }
41  
42  static int event_type(struct cpts_event *event)
43  {
44  return (event->high >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK;
45  }
46  
47  static int cpts_fifo_pop(struct cpts *cpts, u32 *high, u32 *low)
48  {
49  u32 r = cpts_read32(cpts, intstat_raw);
50  
51  if (r & TS_PEND_RAW) {
52  *high = cpts_read32(cpts, event_high);
53  *low  = cpts_read32(cpts, event_low);
54  cpts_write32(cpts, EVENT_POP, event_pop);
55  return 0;
56  }
57  return -1;
58  }
59  
60  static int cpts_purge_events(struct cpts *cpts)
61  {
62  struct list_head *this, *next;
63  struct cpts_event *event;
64  int removed = 0;
65  
66  list_for_each_safe(this, next, >events) {
67  event = list_entry(this, struct cpts_event, list);
68  if (event_expired(event)) {
69  list_del_init(>list);
70  list_add(>list, >pool);
71  ++removed;
72  }
73  }
74  
75  if (removed)
  > 76  dev_dbg(cpts->dev, "cpts: event pool cleaned up %d\n", 
removed);
77  return removed ? 0 : -1;
78  }
79  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v3 07/13] net: ethernet: ti: cpts: clean up event list if event pool is empty

2016-12-03 Thread kbuild test robot
Hi WingMan,

[auto build test ERROR on net/master]
[also build test ERROR on v4.9-rc7 next-20161202]
[cannot apply to net-next/master]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Grygorii-Strashko/net-ethernet-ti-cpts-switch-to-readl-writel_relaxed/20161204-010355
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

Note: the 
linux-review/Grygorii-Strashko/net-ethernet-ti-cpts-switch-to-readl-writel_relaxed/20161204-010355
 HEAD f938805dce662197c057c75ac67849f60da87c9f builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

   In file included from include/linux/dma-mapping.h:6:0,
from include/linux/skbuff.h:34,
from include/linux/ip.h:20,
from include/linux/ptp_classify.h:26,
from drivers/net/ethernet/ti/cpts.c:25:
   drivers/net/ethernet/ti/cpts.c: In function 'cpts_purge_events':
>> drivers/net/ethernet/ti/cpts.c:76:15: error: 'struct cpts' has no member 
>> named 'dev'
  dev_dbg(cpts->dev, "cpts: event pool cleaned up %d\n", removed);
  ^
   include/linux/device.h:1209:26: note: in definition of macro 'dev_dbg'
  dev_printk(KERN_DEBUG, dev, format, ##arg); \
 ^~~
   drivers/net/ethernet/ti/cpts.c: In function 'cpts_fifo_read':
   drivers/net/ethernet/ti/cpts.c:94:16: error: 'struct cpts' has no member 
named 'dev'
   dev_err(cpts->dev, "cpts: event pool empty\n");
   ^~

vim +76 drivers/net/ethernet/ti/cpts.c

19   */
20  #include 
21  #include 
22  #include 
23  #include 
24  #include 
  > 25  #include 
26  #include 
27  #include 
28  #include 
29  #include 
30  #include 
31  
32  #include "cpts.h"
33  
34  #define cpts_read32(c, r)   readl_relaxed(>reg->r)
35  #define cpts_write32(c, v, r)   writel_relaxed(v, >reg->r)
36  
37  static int event_expired(struct cpts_event *event)
38  {
39  return time_after(jiffies, event->tmo);
40  }
41  
42  static int event_type(struct cpts_event *event)
43  {
44  return (event->high >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK;
45  }
46  
47  static int cpts_fifo_pop(struct cpts *cpts, u32 *high, u32 *low)
48  {
49  u32 r = cpts_read32(cpts, intstat_raw);
50  
51  if (r & TS_PEND_RAW) {
52  *high = cpts_read32(cpts, event_high);
53  *low  = cpts_read32(cpts, event_low);
54  cpts_write32(cpts, EVENT_POP, event_pop);
55  return 0;
56  }
57  return -1;
58  }
59  
60  static int cpts_purge_events(struct cpts *cpts)
61  {
62  struct list_head *this, *next;
63  struct cpts_event *event;
64  int removed = 0;
65  
66  list_for_each_safe(this, next, >events) {
67  event = list_entry(this, struct cpts_event, list);
68  if (event_expired(event)) {
69  list_del_init(>list);
70  list_add(>list, >pool);
71  ++removed;
72  }
73  }
74  
75  if (removed)
  > 76  dev_dbg(cpts->dev, "cpts: event pool cleaned up %d\n", 
removed);
77  return removed ? 0 : -1;
78  }
79  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH 1/1] edac: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the call to zalloc_cpumask_var() fails, returning "false" seems
improper. The real value of macro "false" is 0, and 0 means no error.
This patch fixes the bug, returning "-ENOMEM".

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189071

Signed-off-by: Pan Bian 
---
 drivers/edac/amd64_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index ee181c5..72a2c75 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2539,7 +2539,7 @@ static int toggle_ecc_err_reporting(struct ecc_settings 
*s, u16 nid, bool on)
 
if (!zalloc_cpumask_var(, GFP_KERNEL)) {
amd64_warn("%s: error allocating mask\n", __func__);
-   return false;
+   return -ENOMEM;
}
 
get_cpus_on_this_dct_cpumask(cmask, nid);
-- 
1.9.1




[PATCH 1/1] edac: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the call to zalloc_cpumask_var() fails, returning "false" seems
improper. The real value of macro "false" is 0, and 0 means no error.
This patch fixes the bug, returning "-ENOMEM".

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189071

Signed-off-by: Pan Bian 
---
 drivers/edac/amd64_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index ee181c5..72a2c75 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2539,7 +2539,7 @@ static int toggle_ecc_err_reporting(struct ecc_settings 
*s, u16 nid, bool on)
 
if (!zalloc_cpumask_var(, GFP_KERNEL)) {
amd64_warn("%s: error allocating mask\n", __func__);
-   return false;
+   return -ENOMEM;
}
 
get_cpus_on_this_dct_cpumask(cmask, nid);
-- 
1.9.1




[PATCH 1/1] scsi: snic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the calls to mempool_create_slab_pool() return unexpected values,
the value of return variable ret is 0. 0 means no error. Thus, the
caller of fnic_probe() cannot detect the error, and may be misled. This
patch fixes the bug, assigning "-ENOMEM" to ret before calling
mempool_create_slab_pool().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189061

Signed-off-by: Pan Bian 
---
 drivers/scsi/snic/snic_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/snic/snic_main.c b/drivers/scsi/snic/snic_main.c
index 396b32d..e8907e6 100644
--- a/drivers/scsi/snic/snic_main.c
+++ b/drivers/scsi/snic/snic_main.c
@@ -586,6 +586,7 @@
for (i = 0; i < SNIC_IO_LOCKS; i++)
spin_lock_init(>io_req_lock[i]);
 
+   ret = -ENOMEM;
pool = mempool_create_slab_pool(2,
snic_glob->req_cache[SNIC_REQ_CACHE_DFLT_SGL]);
if (!pool) {
-- 
1.9.1




[PATCH 1/1] scsi: snic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the calls to mempool_create_slab_pool() return unexpected values,
the value of return variable ret is 0. 0 means no error. Thus, the
caller of fnic_probe() cannot detect the error, and may be misled. This
patch fixes the bug, assigning "-ENOMEM" to ret before calling
mempool_create_slab_pool().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189061

Signed-off-by: Pan Bian 
---
 drivers/scsi/snic/snic_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/snic/snic_main.c b/drivers/scsi/snic/snic_main.c
index 396b32d..e8907e6 100644
--- a/drivers/scsi/snic/snic_main.c
+++ b/drivers/scsi/snic/snic_main.c
@@ -586,6 +586,7 @@
for (i = 0; i < SNIC_IO_LOCKS; i++)
spin_lock_init(>io_req_lock[i]);
 
+   ret = -ENOMEM;
pool = mempool_create_slab_pool(2,
snic_glob->req_cache[SNIC_REQ_CACHE_DFLT_SGL]);
if (!pool) {
-- 
1.9.1




[PATCH 1/1] scsi: fnic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the calls to mempool_create_slab_pool() return unexpected values,
the value of return variable err is 0. 0 means no error. Thus, the
caller of fnic_probe() cannot detect the error, and may be misled. This
patch fixes the bug, assigning "-ENOMEM" to err before calling
mempool_create_slab_pool().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189051

Signed-off-by: Pan Bian 
---
 drivers/scsi/fnic/fnic_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 58ce902..389c13e 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -735,6 +735,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
for (i = 0; i < FNIC_IO_LOCKS; i++)
spin_lock_init(>io_req_lock[i]);
 
+   err = -ENOMEM;
fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
if (!fnic->io_req_pool)
goto err_out_free_resources;
-- 
1.9.1




[PATCH 1/1] scsi: fnic: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the calls to mempool_create_slab_pool() return unexpected values,
the value of return variable err is 0. 0 means no error. Thus, the
caller of fnic_probe() cannot detect the error, and may be misled. This
patch fixes the bug, assigning "-ENOMEM" to err before calling
mempool_create_slab_pool().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189051

Signed-off-by: Pan Bian 
---
 drivers/scsi/fnic/fnic_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 58ce902..389c13e 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -735,6 +735,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
for (i = 0; i < FNIC_IO_LOCKS; i++)
spin_lock_init(>io_req_lock[i]);
 
+   err = -ENOMEM;
fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
if (!fnic->io_req_pool)
goto err_out_free_resources;
-- 
1.9.1




[PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

If uhw->inlen is non-zero, the value of variable err is 0 if the copy
succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it
will return 0 to the callers. As a result, the callers cannot detect the
errors. This patch fixes the bug, assigning "-ENOMEM" to err before
the NULL pointer checks.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189031

Signed-off-by: Pan Bian 
---
 drivers/infiniband/hw/mlx4/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/hw/mlx4/main.c 
b/drivers/infiniband/hw/mlx4/main.c
index b597e82..f6c5158 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -455,6 +455,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
sizeof(resp.response_length);
in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
+   err = -ENOMEM;
if (!in_mad || !out_mad)
goto out;
 
-- 
1.9.1




[PATCH 1/1] infiniband: hw: mlx4: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

If uhw->inlen is non-zero, the value of variable err is 0 if the copy
succeeds. Then, if kzalloc() or kmalloc() returns a NULL pointer, it
will return 0 to the callers. As a result, the callers cannot detect the
errors. This patch fixes the bug, assigning "-ENOMEM" to err before
the NULL pointer checks.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189031

Signed-off-by: Pan Bian 
---
 drivers/infiniband/hw/mlx4/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/hw/mlx4/main.c 
b/drivers/infiniband/hw/mlx4/main.c
index b597e82..f6c5158 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -455,6 +455,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
sizeof(resp.response_length);
in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
+   err = -ENOMEM;
if (!in_mad || !out_mad)
goto out;
 
-- 
1.9.1




[PATCH 1/1] atm: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

It returns variable "error" when ioremap_nocache() returns a NULL
pointer. The value of "error" is 0 then, which will mislead the callers
to believe that there is no error. This patch fixes the bug, returning
"-ENOMEM".

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189021

Signed-off-by: Pan Bian 
---
 drivers/atm/eni.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index f2aaf9e..40c2d56 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1727,7 +1727,7 @@ static int eni_do_init(struct atm_dev *dev)
printk("\n");
printk(KERN_ERR DEV_LABEL "(itf %d): can't set up page "
"mapping\n",dev->number);
-   return error;
+   return -ENOMEM;
}
eni_dev->ioaddr = base;
eni_dev->base_diff = real_base - (unsigned long) base;
-- 
1.9.1




[PATCH 1/1] atm: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

It returns variable "error" when ioremap_nocache() returns a NULL
pointer. The value of "error" is 0 then, which will mislead the callers
to believe that there is no error. This patch fixes the bug, returning
"-ENOMEM".

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189021

Signed-off-by: Pan Bian 
---
 drivers/atm/eni.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index f2aaf9e..40c2d56 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1727,7 +1727,7 @@ static int eni_do_init(struct atm_dev *dev)
printk("\n");
printk(KERN_ERR DEV_LABEL "(itf %d): can't set up page "
"mapping\n",dev->number);
-   return error;
+   return -ENOMEM;
}
eni_dev->ioaddr = base;
eni_dev->base_diff = real_base - (unsigned long) base;
-- 
1.9.1




[PATCH 1/1] media: pci: meye: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

The value of return variable ret is 0 on some error paths, for example,
when pci_resource_start() returns a NULL pointer. 0 means no error in
this context, which is contrary to the fact. This patch fixes the bug.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189011

Signed-off-by: Pan Bian 
---
 drivers/media/pci/meye/meye.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index ba887e8..115e141 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -1669,6 +1669,7 @@ static int meye_probe(struct pci_dev *pcidev, const 
struct pci_device_id *ent)
goto outenabledev;
}
 
+   ret = -EIO;
mchip_adr = pci_resource_start(meye.mchip_dev,0);
if (!mchip_adr) {
v4l2_err(v4l2_dev, "meye: mchip has no device base address\n");
-- 
1.9.1




[PATCH 1/1] media: pci: meye: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

The value of return variable ret is 0 on some error paths, for example,
when pci_resource_start() returns a NULL pointer. 0 means no error in
this context, which is contrary to the fact. This patch fixes the bug.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189011

Signed-off-by: Pan Bian 
---
 drivers/media/pci/meye/meye.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index ba887e8..115e141 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -1669,6 +1669,7 @@ static int meye_probe(struct pci_dev *pcidev, const 
struct pci_device_id *ent)
goto outenabledev;
}
 
+   ret = -EIO;
mchip_adr = pci_resource_start(meye.mchip_dev,0);
if (!mchip_adr) {
v4l2_err(v4l2_dev, "meye: mchip has no device base address\n");
-- 
1.9.1




[PATCH 1/1] media: pci: meye: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

The value of return variable ret is 0 on some error paths, for example,
when pci_resource_start() returns a NULL pointer. 0 means no error in
this context, which is contrary to the fact. This patch fixes the bug.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189011

Signed-off-by: Pan Bian 
---
 drivers/media/pci/meye/meye.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index ba887e8..115e141 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -1669,6 +1669,7 @@ static int meye_probe(struct pci_dev *pcidev, const 
struct pci_device_id *ent)
goto outenabledev;
}
 
+   ret = -EIO;
mchip_adr = pci_resource_start(meye.mchip_dev,0);
if (!mchip_adr) {
v4l2_err(v4l2_dev, "meye: mchip has no device base address\n");
-- 
1.9.1




[PATCH 1/2] scsi: be2iscsi: set errno on error path

2016-12-03 Thread Pan Bian
From: Pan Bian 

Variable ret is reset in the loop, and its value will be 0 during the
second and after repeat of the loop. If pci_alloc_consistent() returns a
NULL pointer then, it will leaves with return value 0. 0 means no error,
which is contrary to the fact. This patches fixes the bug, explicitly
assigning "-ENOMEM" to return variable ret on the path that the call to
pci_alloc_consistent() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188941

Signed-off-by: Pan Bian 
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d9239c2..b6c5791 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3113,8 +3113,10 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
cq_vaddress = pci_alloc_consistent(phba->pcidev,
   num_cq_pages * PAGE_SIZE,
   );
-   if (!cq_vaddress)
+   if (!cq_vaddress) {
+   ret = -ENOMEM;
goto create_cq_error;
+   }
 
ret = be_fill_queue(cq, phba->params.num_cq_entries,
sizeof(struct sol_cqe), cq_vaddress);
-- 
1.9.1




[PATCH 1/1] media: pci: meye: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

The value of return variable ret is 0 on some error paths, for example,
when pci_resource_start() returns a NULL pointer. 0 means no error in
this context, which is contrary to the fact. This patch fixes the bug.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189011

Signed-off-by: Pan Bian 
---
 drivers/media/pci/meye/meye.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index ba887e8..115e141 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -1669,6 +1669,7 @@ static int meye_probe(struct pci_dev *pcidev, const 
struct pci_device_id *ent)
goto outenabledev;
}
 
+   ret = -EIO;
mchip_adr = pci_resource_start(meye.mchip_dev,0);
if (!mchip_adr) {
v4l2_err(v4l2_dev, "meye: mchip has no device base address\n");
-- 
1.9.1




[PATCH 1/2] scsi: be2iscsi: set errno on error path

2016-12-03 Thread Pan Bian
From: Pan Bian 

Variable ret is reset in the loop, and its value will be 0 during the
second and after repeat of the loop. If pci_alloc_consistent() returns a
NULL pointer then, it will leaves with return value 0. 0 means no error,
which is contrary to the fact. This patches fixes the bug, explicitly
assigning "-ENOMEM" to return variable ret on the path that the call to
pci_alloc_consistent() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188941

Signed-off-by: Pan Bian 
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d9239c2..b6c5791 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3113,8 +3113,10 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
cq_vaddress = pci_alloc_consistent(phba->pcidev,
   num_cq_pages * PAGE_SIZE,
   );
-   if (!cq_vaddress)
+   if (!cq_vaddress) {
+   ret = -ENOMEM;
goto create_cq_error;
+   }
 
ret = be_fill_queue(cq, phba->params.num_cq_entries,
sizeof(struct sol_cqe), cq_vaddress);
-- 
1.9.1




[PATCH 1/1] scsi: 3w-sas: set errno on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

On some error paths (e.g. pci_iomap() returns a NULL pointer), the value
of return variable retval is 0. 0 means no error. This patch fixes the
bug, set retval with negative errno on error paths.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189001

Signed-off-by: Pan Bian 
---
 drivers/scsi/3w-sas.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index f837485..65b42b4 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -1600,6 +1600,7 @@ static int twl_probe(struct pci_dev *pdev, const struct 
pci_device_id *dev_id)
 
if (twl_initialize_device_extension(tw_dev)) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Failed to initialize 
device extension");
+   retval = -ENODEV;
goto out_free_device_extension;
}
 
@@ -1614,6 +1615,7 @@ static int twl_probe(struct pci_dev *pdev, const struct 
pci_device_id *dev_id)
tw_dev->base_addr = pci_iomap(pdev, 1, 0);
if (!tw_dev->base_addr) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to ioremap");
+   retval = -ENOMEM;
goto out_release_mem_region;
}
 
@@ -1623,6 +1625,7 @@ static int twl_probe(struct pci_dev *pdev, const struct 
pci_device_id *dev_id)
/* Initialize the card */
if (twl_reset_sequence(tw_dev, 0)) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1d, "Controller reset 
failed during probe");
+   retval = -ENODEV;
goto out_iounmap;
}
 
-- 
1.9.1




[PATCH 1/1] scsi: 3w-sas: set errno on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

On some error paths (e.g. pci_iomap() returns a NULL pointer), the value
of return variable retval is 0. 0 means no error. This patch fixes the
bug, set retval with negative errno on error paths.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189001

Signed-off-by: Pan Bian 
---
 drivers/scsi/3w-sas.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index f837485..65b42b4 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -1600,6 +1600,7 @@ static int twl_probe(struct pci_dev *pdev, const struct 
pci_device_id *dev_id)
 
if (twl_initialize_device_extension(tw_dev)) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Failed to initialize 
device extension");
+   retval = -ENODEV;
goto out_free_device_extension;
}
 
@@ -1614,6 +1615,7 @@ static int twl_probe(struct pci_dev *pdev, const struct 
pci_device_id *dev_id)
tw_dev->base_addr = pci_iomap(pdev, 1, 0);
if (!tw_dev->base_addr) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to ioremap");
+   retval = -ENOMEM;
goto out_release_mem_region;
}
 
@@ -1623,6 +1625,7 @@ static int twl_probe(struct pci_dev *pdev, const struct 
pci_device_id *dev_id)
/* Initialize the card */
if (twl_reset_sequence(tw_dev, 0)) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1d, "Controller reset 
failed during probe");
+   retval = -ENODEV;
goto out_iounmap;
}
 
-- 
1.9.1




[PATCH 1/1] memstick: host: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When pci_ioremap_bar() returns a NULL pointer, the value of return
variable "error" is 0. 0 means no error, which is contrary to the fact.
Similarly, the return values are also improper when request_irq() or
memstick_add_host() returns unexpected values. This patch fixes the bug,
assigning "-ENOMEM" to variable "error" before the call to
pci_ioremap_bar().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188991

Signed-off-by: Pan Bian 
---
 drivers/memstick/host/r592.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
index d5cfb50..eebed0a 100644
--- a/drivers/memstick/host/r592.c
+++ b/drivers/memstick/host/r592.c
@@ -761,6 +761,7 @@ static int r592_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
if (error)
goto error3;
 
+   error = -ENOMEM;
dev->mmio = pci_ioremap_bar(pdev, 0);
if (!dev->mmio)
goto error4;
-- 
1.9.1




[PATCH 1/1] memstick: host: fix improper return value

2016-12-03 Thread Pan Bian
From: Pan Bian 

When pci_ioremap_bar() returns a NULL pointer, the value of return
variable "error" is 0. 0 means no error, which is contrary to the fact.
Similarly, the return values are also improper when request_irq() or
memstick_add_host() returns unexpected values. This patch fixes the bug,
assigning "-ENOMEM" to variable "error" before the call to
pci_ioremap_bar().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188991

Signed-off-by: Pan Bian 
---
 drivers/memstick/host/r592.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
index d5cfb50..eebed0a 100644
--- a/drivers/memstick/host/r592.c
+++ b/drivers/memstick/host/r592.c
@@ -761,6 +761,7 @@ static int r592_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
if (error)
goto error3;
 
+   error = -ENOMEM;
dev->mmio = pci_ioremap_bar(pdev, 0);
if (!dev->mmio)
goto error4;
-- 
1.9.1




include/linux/bug.h:37:45: error: bit-field '' width not an integer constant

2016-12-03 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0cb65c83304a341b9d09678448d7c8b550689531
commit: 80cca775cdc4f8555612d2943a2872076b33e0ff net: fec: cache statistics 
while device is down
date:   4 days ago
config: m68k-m5272c3_defconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 80cca775cdc4f8555612d2943a2872076b33e0ff
# save the attached .config to linux build tree
make.cross ARCH=m68k 

All errors (new ones prefixed by >>):

   drivers/net/ethernet/freescale/fec_main.c: In function 'fec_restart':
   drivers/net/ethernet/freescale/fec_main.c:896:6: warning: unused variable 
'val' [-Wunused-variable]
 u32 val;
 ^
   drivers/net/ethernet/freescale/fec_main.c: In function 'fec_get_mac':
   drivers/net/ethernet/freescale/fec_main.c:1628:28: warning: unused variable 
'pdata' [-Wunused-variable]
 struct fec_platform_data *pdata = dev_get_platdata(>pdev->dev);
   ^
   drivers/net/ethernet/freescale/fec_main.c: In function 'fec_enet_close':
   drivers/net/ethernet/freescale/fec_main.c:2887:2: error: implicit 
declaration of function 'fec_enet_update_ethtool_stats' 
[-Werror=implicit-function-declaration]
 fec_enet_update_ethtool_stats(ndev);
 ^
   In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/net/ethernet/freescale/fec_main.c:24:
   drivers/net/ethernet/freescale/fec_main.c: In function 'fec_probe':
   drivers/net/ethernet/freescale/fec_main.c:3296:18: error: 'fec_stats' 
undeclared (first use in this function)
  ARRAY_SIZE(fec_stats) * sizeof(u64),
 ^
   include/linux/kernel.h:53:33: note: in definition of macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
^
   drivers/net/ethernet/freescale/fec_main.c:3296:18: note: each undeclared 
identifier is reported only once for each function it appears in
  ARRAY_SIZE(fec_stats) * sizeof(u64),
 ^
   include/linux/kernel.h:53:33: note: in definition of macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
^
   In file included from include/linux/thread_info.h:11:0,
from include/asm-generic/preempt.h:4,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from drivers/net/ethernet/freescale/fec_main.c:24:
>> include/linux/bug.h:37:45: error: bit-field '' width not an 
>> integer constant
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 
'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
   ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
  ^
   drivers/net/ethernet/freescale/fec_main.c:3296:7: note: in expansion of 
macro 'ARRAY_SIZE'
  ARRAY_SIZE(fec_stats) * sizeof(u64),
  ^
   cc1: some warnings being treated as errors

vim +37 include/linux/bug.h

9a8ab1c39 Daniel Santos 2013-02-21  21  #define BUILD_BUG_ON_MSG(cond, 
msg) (0)
ca623c914 Daniel Santos 2013-02-21  22  #define BUILD_BUG_ON(condition) 
(0)
35edd9103 Paul Gortmaker2011-11-16  23  #define BUILD_BUG() (0)
ff20c2e0a Kirill A. Shutemov2016-03-01  24  #define 
MAYBE_BUILD_BUG_ON(cond) (0)
35edd9103 Paul Gortmaker2011-11-16  25  #else /* __CHECKER__ */
35edd9103 Paul Gortmaker2011-11-16  26  
35edd9103 Paul Gortmaker2011-11-16  27  /* Force a compilation error if 
a constant expression is not a power of 2 */
3e9b3112e Jakub Kicinski2016-08-31  28  #define 
__BUILD_BUG_ON_NOT_POWER_OF_2(n)\
3e9b3112e Jakub Kicinski2016-08-31  29  BUILD_BUG_ON(((n) & 
((n) - 1)) != 0)
35edd9103 Paul Gortmaker2011-11-16  30  #define 
BUILD_BUG_ON_NOT_POWER_OF_2(n)  \
35edd9103 Paul Gortmaker2011-11-16  31  BUILD_BUG_ON((n) == 0 
|| (((n) & ((n) - 1)) != 0))
35edd9103 Paul Gortmaker2011-11-16  32  
35edd9103 Paul Gortmaker

include/linux/bug.h:37:45: error: bit-field '' width not an integer constant

2016-12-03 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0cb65c83304a341b9d09678448d7c8b550689531
commit: 80cca775cdc4f8555612d2943a2872076b33e0ff net: fec: cache statistics 
while device is down
date:   4 days ago
config: m68k-m5272c3_defconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 80cca775cdc4f8555612d2943a2872076b33e0ff
# save the attached .config to linux build tree
make.cross ARCH=m68k 

All errors (new ones prefixed by >>):

   drivers/net/ethernet/freescale/fec_main.c: In function 'fec_restart':
   drivers/net/ethernet/freescale/fec_main.c:896:6: warning: unused variable 
'val' [-Wunused-variable]
 u32 val;
 ^
   drivers/net/ethernet/freescale/fec_main.c: In function 'fec_get_mac':
   drivers/net/ethernet/freescale/fec_main.c:1628:28: warning: unused variable 
'pdata' [-Wunused-variable]
 struct fec_platform_data *pdata = dev_get_platdata(>pdev->dev);
   ^
   drivers/net/ethernet/freescale/fec_main.c: In function 'fec_enet_close':
   drivers/net/ethernet/freescale/fec_main.c:2887:2: error: implicit 
declaration of function 'fec_enet_update_ethtool_stats' 
[-Werror=implicit-function-declaration]
 fec_enet_update_ethtool_stats(ndev);
 ^
   In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/net/ethernet/freescale/fec_main.c:24:
   drivers/net/ethernet/freescale/fec_main.c: In function 'fec_probe':
   drivers/net/ethernet/freescale/fec_main.c:3296:18: error: 'fec_stats' 
undeclared (first use in this function)
  ARRAY_SIZE(fec_stats) * sizeof(u64),
 ^
   include/linux/kernel.h:53:33: note: in definition of macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
^
   drivers/net/ethernet/freescale/fec_main.c:3296:18: note: each undeclared 
identifier is reported only once for each function it appears in
  ARRAY_SIZE(fec_stats) * sizeof(u64),
 ^
   include/linux/kernel.h:53:33: note: in definition of macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
^
   In file included from include/linux/thread_info.h:11:0,
from include/asm-generic/preempt.h:4,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from drivers/net/ethernet/freescale/fec_main.c:24:
>> include/linux/bug.h:37:45: error: bit-field '' width not an 
>> integer constant
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 
'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
   ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
  ^
   drivers/net/ethernet/freescale/fec_main.c:3296:7: note: in expansion of 
macro 'ARRAY_SIZE'
  ARRAY_SIZE(fec_stats) * sizeof(u64),
  ^
   cc1: some warnings being treated as errors

vim +37 include/linux/bug.h

9a8ab1c39 Daniel Santos 2013-02-21  21  #define BUILD_BUG_ON_MSG(cond, 
msg) (0)
ca623c914 Daniel Santos 2013-02-21  22  #define BUILD_BUG_ON(condition) 
(0)
35edd9103 Paul Gortmaker2011-11-16  23  #define BUILD_BUG() (0)
ff20c2e0a Kirill A. Shutemov2016-03-01  24  #define 
MAYBE_BUILD_BUG_ON(cond) (0)
35edd9103 Paul Gortmaker2011-11-16  25  #else /* __CHECKER__ */
35edd9103 Paul Gortmaker2011-11-16  26  
35edd9103 Paul Gortmaker2011-11-16  27  /* Force a compilation error if 
a constant expression is not a power of 2 */
3e9b3112e Jakub Kicinski2016-08-31  28  #define 
__BUILD_BUG_ON_NOT_POWER_OF_2(n)\
3e9b3112e Jakub Kicinski2016-08-31  29  BUILD_BUG_ON(((n) & 
((n) - 1)) != 0)
35edd9103 Paul Gortmaker2011-11-16  30  #define 
BUILD_BUG_ON_NOT_POWER_OF_2(n)  \
35edd9103 Paul Gortmaker2011-11-16  31  BUILD_BUG_ON((n) == 0 
|| (((n) & ((n) - 1)) != 0))
35edd9103 Paul Gortmaker2011-11-16  32  
35edd9103 Paul Gortmaker

[PATCH 1/1] net: irda: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the calls to kzalloc() fail, the value of return variable ret may
be 0. 0 means success in this context. This patch fixes the bug,
assigning "-ENOMEM" to ret before calling kzalloc().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188971

Signed-off-by: Pan Bian 
---
 drivers/net/irda/irda-usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index a198946..8716b8c 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1723,6 +1723,7 @@ static int irda_usb_probe(struct usb_interface *intf,
/* Don't change this buffer size and allocation without doing
 * some heavy and complete testing. Don't ask why :-(
 * Jean II */
+   ret = -ENOMEM;
self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
if (!self->speed_buff)
goto err_out_3;
-- 
1.9.1




[PATCH 1/1] net: irda: set error code on failures

2016-12-03 Thread Pan Bian
From: Pan Bian 

When the calls to kzalloc() fail, the value of return variable ret may
be 0. 0 means success in this context. This patch fixes the bug,
assigning "-ENOMEM" to ret before calling kzalloc().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188971

Signed-off-by: Pan Bian 
---
 drivers/net/irda/irda-usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index a198946..8716b8c 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1723,6 +1723,7 @@ static int irda_usb_probe(struct usb_interface *intf,
/* Don't change this buffer size and allocation without doing
 * some heavy and complete testing. Don't ask why :-(
 * Jean II */
+   ret = -ENOMEM;
self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
if (!self->speed_buff)
goto err_out_3;
-- 
1.9.1




[PATCH 2/2] scsi: be2iscsi: set errno on error path

2016-12-03 Thread Pan Bian
From: Pan Bian 

Variable ret is reset in the loop, and its value will be 0 during the
second and after repeat of the loop. If pci_alloc_consistent() returns a
NULL pointer then, it will leaves with return value 0. 0 means no error,
which is contrary to the fact. This patches fixes the bug, explicitly 
assigning "-ENOMEM" to return variable ret on the path that the call to 
pci_alloc_consistent() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188951

Signed-off-by: Pan Bian 
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index b6c5791..b5112d6 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3049,8 +3049,10 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
eq_vaddress = pci_alloc_consistent(phba->pcidev,
   num_eq_pages * PAGE_SIZE,
   );
-   if (!eq_vaddress)
+   if (!eq_vaddress) {
+   ret = -ENOMEM;
goto create_eq_error;
+   }
 
mem->va = eq_vaddress;
ret = be_fill_queue(eq, phba->params.num_eq_entries,
-- 
1.9.1




[PATCH 2/2] scsi: be2iscsi: set errno on error path

2016-12-03 Thread Pan Bian
From: Pan Bian 

Variable ret is reset in the loop, and its value will be 0 during the
second and after repeat of the loop. If pci_alloc_consistent() returns a
NULL pointer then, it will leaves with return value 0. 0 means no error,
which is contrary to the fact. This patches fixes the bug, explicitly 
assigning "-ENOMEM" to return variable ret on the path that the call to 
pci_alloc_consistent() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188951

Signed-off-by: Pan Bian 
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index b6c5791..b5112d6 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3049,8 +3049,10 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
eq_vaddress = pci_alloc_consistent(phba->pcidev,
   num_eq_pages * PAGE_SIZE,
   );
-   if (!eq_vaddress)
+   if (!eq_vaddress) {
+   ret = -ENOMEM;
goto create_eq_error;
+   }
 
mem->va = eq_vaddress;
ret = be_fill_queue(eq, phba->params.num_eq_entries,
-- 
1.9.1




[PATCH 1/1] isdn: hisax: set error code on failure

2016-12-03 Thread Pan Bian
From: Pan Bian 

In function hfc4s8s_probe(), the value of return variable err should be
negative on failures. However, when the call to request_region() returns
NULL, the value of err is 0. This patch fixes the bug, assiging
"-ENOMEM" to err on the path that request_region() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188931

Signed-off-by: Pan Bian 
---
 drivers/isdn/hisax/hfc4s8s_l1.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index 9600cd7..3172cee 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -1499,6 +1499,7 @@ struct hfc4s8s_l1 {
printk(KERN_INFO
   "HFC-4S/8S: failed to request address space at 0x%04x\n",
   hw->iobase);
+   err = -ENOMEM;
goto out;
}
 
-- 
1.9.1




[PATCH 1/1] isdn: hisax: set error code on failure

2016-12-03 Thread Pan Bian
From: Pan Bian 

In function hfc4s8s_probe(), the value of return variable err should be
negative on failures. However, when the call to request_region() returns
NULL, the value of err is 0. This patch fixes the bug, assiging
"-ENOMEM" to err on the path that request_region() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188931

Signed-off-by: Pan Bian 
---
 drivers/isdn/hisax/hfc4s8s_l1.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index 9600cd7..3172cee 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -1499,6 +1499,7 @@ struct hfc4s8s_l1 {
printk(KERN_INFO
   "HFC-4S/8S: failed to request address space at 0x%04x\n",
   hw->iobase);
+   err = -ENOMEM;
goto out;
}
 
-- 
1.9.1




[PATCH 1/1] input: usbhid: fix improper check

2016-12-03 Thread Pan Bian
From: Pan Bian 

Function hid_post_reset() returns 0 on success, or 1 on failures.
However, in function hid_reset_resume(), uses "status >= 0" to check the
return value of hid_post_reset(). Obviously, the condition will always
be satisfied. This patch fixes the bug, uses "status == 0" to check the
return value.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188921

Signed-off-by: Pan Bian 
---
 drivers/hid/usbhid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index ae83af6..3639b70 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1590,7 +1590,7 @@ static int hid_reset_resume(struct usb_interface *intf)
int status;
 
status = hid_post_reset(intf);
-   if (status >= 0 && hid->driver && hid->driver->reset_resume) {
+   if (status == 0 && hid->driver && hid->driver->reset_resume) {
int ret = hid->driver->reset_resume(hid);
if (ret < 0)
status = ret;
-- 
1.9.1




[PATCH 1/1] input: usbhid: fix improper check

2016-12-03 Thread Pan Bian
From: Pan Bian 

Function hid_post_reset() returns 0 on success, or 1 on failures.
However, in function hid_reset_resume(), uses "status >= 0" to check the
return value of hid_post_reset(). Obviously, the condition will always
be satisfied. This patch fixes the bug, uses "status == 0" to check the
return value.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188921

Signed-off-by: Pan Bian 
---
 drivers/hid/usbhid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index ae83af6..3639b70 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1590,7 +1590,7 @@ static int hid_reset_resume(struct usb_interface *intf)
int status;
 
status = hid_post_reset(intf);
-   if (status >= 0 && hid->driver && hid->driver->reset_resume) {
+   if (status == 0 && hid->driver && hid->driver->reset_resume) {
int ret = hid->driver->reset_resume(hid);
if (ret < 0)
status = ret;
-- 
1.9.1




Re: [PATCH 1/1] net: dcb: set error code on failures

2016-12-03 Thread David Miller
From: Pan Bian 
Date: Sat,  3 Dec 2016 21:49:08 +0800

> From: Pan Bian 
> 
> In function dcbnl_cee_fill(), returns the value of variable err on
> errors. However, on some error paths (e.g. nla put fails), its value may
> be 0. It may be better to explicitly set a negative errno to variable
> err before returning.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=11
> 
> Signed-off-by: Pan Bian 

Applied, thanks.


Re: [PATCH 1/1] net: dcb: set error code on failures

2016-12-03 Thread David Miller
From: Pan Bian 
Date: Sat,  3 Dec 2016 21:49:08 +0800

> From: Pan Bian 
> 
> In function dcbnl_cee_fill(), returns the value of variable err on
> errors. However, on some error paths (e.g. nla put fails), its value may
> be 0. It may be better to explicitly set a negative errno to variable
> err before returning.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=11
> 
> Signed-off-by: Pan Bian 

Applied, thanks.


[PATCH 1/1] btrfs: fix improper return value

2016-12-03 Thread Pan Bian
In function btrfs_uuid_tree_iterate(), errno is assigned to variable ret
on errors. However, it directly returns 0. It may be better to return
ret. This patch also removes the warning, because the caller already
prints a warning.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188731
Signed-off-by: Pan Bian 
---
 fs/btrfs/uuid-tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
index 7fc89e4..83bb2f2 100644
--- a/fs/btrfs/uuid-tree.c
+++ b/fs/btrfs/uuid-tree.c
@@ -351,7 +351,5 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
 
 out:
btrfs_free_path(path);
-   if (ret)
-   btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret);
-   return 0;
+   return ret;
 }
-- 
1.9.1




[PATCH 1/1] btrfs: fix improper return value

2016-12-03 Thread Pan Bian
In function btrfs_uuid_tree_iterate(), errno is assigned to variable ret
on errors. However, it directly returns 0. It may be better to return
ret. This patch also removes the warning, because the caller already
prints a warning.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188731
Signed-off-by: Pan Bian 
---
 fs/btrfs/uuid-tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
index 7fc89e4..83bb2f2 100644
--- a/fs/btrfs/uuid-tree.c
+++ b/fs/btrfs/uuid-tree.c
@@ -351,7 +351,5 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
 
 out:
btrfs_free_path(path);
-   if (ret)
-   btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret);
-   return 0;
+   return ret;
 }
-- 
1.9.1




Re: [PATCH net-next] liquidio: 'imply' ptp instead of 'select'

2016-12-03 Thread David Miller
From: Arnd Bergmann 
Date: Sat,  3 Dec 2016 00:04:32 +0100

> ptp now depends on the optional POSIX_TIMERS setting and fails to build
> if we select it without that:
> 
> warning: (LIQUIDIO_VF && TI_CPTS) selects PTP_1588_CLOCK which has unmet 
> direct dependencies (NET && POSIX_TIMERS)
> warning: (LIQUIDIO_VF && TI_CPTS) selects PTP_1588_CLOCK which has unmet 
> direct dependencies (NET && POSIX_TIMERS)
> ERROR: "posix_clock_unregister" [drivers/ptp/ptp.ko] undefined!
> ERROR: "posix_clock_register" [drivers/ptp/ptp.ko] undefined!
> ERROR: "pps_unregister_source" [drivers/ptp/ptp.ko] undefined!
> ERROR: "pps_event" [drivers/ptp/ptp.ko] undefined!
> ERROR: "pps_register_source" [drivers/ptp/ptp.ko] undefined!
> 
> It seems that two patches have collided here, the build failure
> is a result of the combination. Changing the new option to 'imply'
> as well fixes it.
> 
> Fixes: 111fc64a237f ("liquidio CN23XX: VF registration")
> Fixes: d1cbfd771ce8 ("ptp_clock: Allow for it to be optional")
> Signed-off-by: Arnd Bergmann 

Like the kbuild robot, when I apply this it complains about 'imply' being
an unknown option.

I guess it worked for you because support for 'imply' exists in the -next
tree and gets pulled in from somewhere else.

In any event, as-is I cannot apply this.


Re: [PATCH net-next] liquidio: 'imply' ptp instead of 'select'

2016-12-03 Thread David Miller
From: Arnd Bergmann 
Date: Sat,  3 Dec 2016 00:04:32 +0100

> ptp now depends on the optional POSIX_TIMERS setting and fails to build
> if we select it without that:
> 
> warning: (LIQUIDIO_VF && TI_CPTS) selects PTP_1588_CLOCK which has unmet 
> direct dependencies (NET && POSIX_TIMERS)
> warning: (LIQUIDIO_VF && TI_CPTS) selects PTP_1588_CLOCK which has unmet 
> direct dependencies (NET && POSIX_TIMERS)
> ERROR: "posix_clock_unregister" [drivers/ptp/ptp.ko] undefined!
> ERROR: "posix_clock_register" [drivers/ptp/ptp.ko] undefined!
> ERROR: "pps_unregister_source" [drivers/ptp/ptp.ko] undefined!
> ERROR: "pps_event" [drivers/ptp/ptp.ko] undefined!
> ERROR: "pps_register_source" [drivers/ptp/ptp.ko] undefined!
> 
> It seems that two patches have collided here, the build failure
> is a result of the combination. Changing the new option to 'imply'
> as well fixes it.
> 
> Fixes: 111fc64a237f ("liquidio CN23XX: VF registration")
> Fixes: d1cbfd771ce8 ("ptp_clock: Allow for it to be optional")
> Signed-off-by: Arnd Bergmann 

Like the kbuild robot, when I apply this it complains about 'imply' being
an unknown option.

I guess it worked for you because support for 'imply' exists in the -next
tree and gets pulled in from somewhere else.

In any event, as-is I cannot apply this.


Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available [ver #3]

2016-12-03 Thread Al Viro
On Wed, Nov 23, 2016 at 12:55:51AM +, David Howells wrote:

> + * vfs_xgetattr - Get the enhanced basic attributes of a file
> + * @path: The file of interest
> + * @stat: Where to return the statistics
> + *
> + * Ask the filesystem for a file's attributes.  The caller must have preset
> + * stat->request_mask and stat->query_flags to indicate what they want.
> + *
> + * If the file is remote, the filesystem can be forced to update the 
> attributes
> + * from the backing store by passing AT_FORCE_ATTR_SYNC in query_flags or can
> + * suppress the update by passing AT_NO_ATTR_SYNC.
> + *
> + * Bits must have been set in stat->request_mask to indicate which attributes
> + * the caller wants retrieving.  Any such attribute not requested may be
> + * returned anyway, but the value may be approximate, and, if remote, may not
> + * have been synchronised with the server.

I understand wanting to avoid extra arguments, but you are asking for trouble
with that sort of calling conventions.  Verifying that all call chains have
these fields initialized is bloody unpleasant and it *is* going to break,
especially since the rules are "you need to initialize it for vfs_xgetattr(),
but not for vfs_getattr()" - the names are similar enough for confusion,
and that's not the only such pair.


Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available [ver #3]

2016-12-03 Thread Al Viro
On Wed, Nov 23, 2016 at 12:55:51AM +, David Howells wrote:

> + * vfs_xgetattr - Get the enhanced basic attributes of a file
> + * @path: The file of interest
> + * @stat: Where to return the statistics
> + *
> + * Ask the filesystem for a file's attributes.  The caller must have preset
> + * stat->request_mask and stat->query_flags to indicate what they want.
> + *
> + * If the file is remote, the filesystem can be forced to update the 
> attributes
> + * from the backing store by passing AT_FORCE_ATTR_SYNC in query_flags or can
> + * suppress the update by passing AT_NO_ATTR_SYNC.
> + *
> + * Bits must have been set in stat->request_mask to indicate which attributes
> + * the caller wants retrieving.  Any such attribute not requested may be
> + * returned anyway, but the value may be approximate, and, if remote, may not
> + * have been synchronised with the server.

I understand wanting to avoid extra arguments, but you are asking for trouble
with that sort of calling conventions.  Verifying that all call chains have
these fields initialized is bloody unpleasant and it *is* going to break,
especially since the rules are "you need to initialize it for vfs_xgetattr(),
but not for vfs_getattr()" - the names are similar enough for confusion,
and that's not the only such pair.


Re: [PATCH] dt-binding: soc: qcom: smd: Add label property

2016-12-03 Thread Andy Gross
On Wed, Oct 26, 2016 at 05:08:20PM -0500, Rob Herring wrote:
> On Wed, Oct 19, 2016 at 07:38:10PM -0700, Bjorn Andersson wrote:
> > The label property can be used to specify a name of the edge, for
> > consistent naming purposes.
> > 
> > Signed-off-by: Bjorn Andersson 
> > ---
> >  Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt | 7 +++
> >  1 file changed, 7 insertions(+)
> 
> Acked-by: Rob Herring 

Acked-by: Andy Gross 


Re: [PATCH] dt-binding: soc: qcom: smd: Add label property

2016-12-03 Thread Andy Gross
On Wed, Oct 26, 2016 at 05:08:20PM -0500, Rob Herring wrote:
> On Wed, Oct 19, 2016 at 07:38:10PM -0700, Bjorn Andersson wrote:
> > The label property can be used to specify a name of the edge, for
> > consistent naming purposes.
> > 
> > Signed-off-by: Bjorn Andersson 
> > ---
> >  Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt | 7 +++
> >  1 file changed, 7 insertions(+)
> 
> Acked-by: Rob Herring 

Acked-by: Andy Gross 


[PATCH 1/1] net: caif: remove ineffective check

2016-12-03 Thread Pan Bian
The check of the return value of sock_register() is ineffective.
"if(!err)" seems to be a typo. It is better to propagate the error code
to the callers of caif_sktinit_module(). This patch removes the check
statment and directly returns the result of sock_register().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751
Signed-off-by: Pan Bian 
---
 net/caif/caif_socket.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index aa209b1..92cbbd2 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -1107,10 +1107,7 @@ static int caif_create(struct net *net, struct socket 
*sock, int protocol,
 
 static int __init caif_sktinit_module(void)
 {
-   int err = sock_register(_family_ops);
-   if (!err)
-   return err;
-   return 0;
+   return sock_register(_family_ops);
 }
 
 static void __exit caif_sktexit_module(void)
-- 
1.9.1




[PATCH 1/1] net: caif: remove ineffective check

2016-12-03 Thread Pan Bian
The check of the return value of sock_register() is ineffective.
"if(!err)" seems to be a typo. It is better to propagate the error code
to the callers of caif_sktinit_module(). This patch removes the check
statment and directly returns the result of sock_register().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751
Signed-off-by: Pan Bian 
---
 net/caif/caif_socket.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index aa209b1..92cbbd2 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -1107,10 +1107,7 @@ static int caif_create(struct net *net, struct socket 
*sock, int protocol,
 
 static int __init caif_sktinit_module(void)
 {
-   int err = sock_register(_family_ops);
-   if (!err)
-   return err;
-   return 0;
+   return sock_register(_family_ops);
 }
 
 static void __exit caif_sktexit_module(void)
-- 
1.9.1




cc1: error: '-march=r3900' requires '-mfp32'

2016-12-03 Thread kbuild test robot
Hi James,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0cb65c83304a341b9d09678448d7c8b550689531
commit: 034827c727f7f3946a18355b63995b402c226c82 MIPS: Fix -mabi=64 build of 
vdso.lds
date:   8 weeks ago
config: mips-jmr3927_defconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 034827c727f7f3946a18355b63995b402c226c82
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

>> cc1: error: '-march=r3900' requires '-mfp32'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


cc1: error: '-march=r3900' requires '-mfp32'

2016-12-03 Thread kbuild test robot
Hi James,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0cb65c83304a341b9d09678448d7c8b550689531
commit: 034827c727f7f3946a18355b63995b402c226c82 MIPS: Fix -mabi=64 build of 
vdso.lds
date:   8 weeks ago
config: mips-jmr3927_defconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 034827c727f7f3946a18355b63995b402c226c82
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

>> cc1: error: '-march=r3900' requires '-mfp32'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available [ver #3]

2016-12-03 Thread Al Viro
On Wed, Nov 23, 2016 at 12:55:51AM +, David Howells wrote:

> -int vfs_getattr_nosec(struct path *path, struct kstat *stat)
> +int vfs_xgetattr_nosec(struct path *path, struct kstat *stat)

const struct path *, please.  Especially since we feed >f_path to
it.  And yes, I realize that the same applies to vfs_getattr() in the
current tree.

> +int vfs_xgetattr(struct path *path, struct kstat *stat)

Ditto.

> +int vfs_getattr(struct path *path, struct kstat *stat)

Again.

> +#define __put_timestamp(kts, uts) (  \
> + __put_user(kts.tv_sec,  uts.tv_sec  ) ||\
> + __put_user(kts.tv_nsec, uts.tv_nsec ) ||\
> + __put_user(0,   uts.__reserved  ))

static inline.

> +#define KSTAT_ATTR_FS_IOC_FLAGS  0x0874 /* Attrs 
> corresponding to FS_*_FL flags */

Err...  An explicit hex constant?


Re: [PATCH 1/4] statx: Add a system call to make enhanced file info available [ver #3]

2016-12-03 Thread Al Viro
On Wed, Nov 23, 2016 at 12:55:51AM +, David Howells wrote:

> -int vfs_getattr_nosec(struct path *path, struct kstat *stat)
> +int vfs_xgetattr_nosec(struct path *path, struct kstat *stat)

const struct path *, please.  Especially since we feed >f_path to
it.  And yes, I realize that the same applies to vfs_getattr() in the
current tree.

> +int vfs_xgetattr(struct path *path, struct kstat *stat)

Ditto.

> +int vfs_getattr(struct path *path, struct kstat *stat)

Again.

> +#define __put_timestamp(kts, uts) (  \
> + __put_user(kts.tv_sec,  uts.tv_sec  ) ||\
> + __put_user(kts.tv_nsec, uts.tv_nsec ) ||\
> + __put_user(0,   uts.__reserved  ))

static inline.

> +#define KSTAT_ATTR_FS_IOC_FLAGS  0x0874 /* Attrs 
> corresponding to FS_*_FL flags */

Err...  An explicit hex constant?


Re: [PATCH V4 2/2] pinctrl: tegra: Add driver to configure voltage and power of io pads

2016-12-03 Thread kbuild test robot
Hi Laxman,

[auto build test ERROR on tegra/for-next]
[also build test ERROR on v4.9-rc7 next-20161202]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Laxman-Dewangan/pinctrl-tegra-Add-DT-binding-for-io-pads-control/20161124-185652
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/pinctrl/tegra/pinctrl-tegra-io-pad.c: In function 
'tegra_io_pads_pinconf_get':
>> drivers/pinctrl/tegra/pinctrl-tegra-io-pad.c:124:9: error: implicit 
>> declaration of function 'tegra_io_pad_power_get_status' 
>> [-Werror=implicit-function-declaration]
  ret = tegra_io_pad_power_get_status(cfg->id);
^
   cc1: some warnings being treated as errors

vim +/tegra_io_pad_power_get_status +124 
drivers/pinctrl/tegra/pinctrl-tegra-io-pad.c

   118  dev_err(tiopi->dev,
   119  "IO pad %s does not support low 
power\n",
   120  cfg->name);
   121  return -EINVAL;
   122  }
   123  
 > 124  ret = tegra_io_pad_power_get_status(cfg->id);
   125  if (ret < 0)
   126  return ret;
   127  arg = !ret;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH V4 2/2] pinctrl: tegra: Add driver to configure voltage and power of io pads

2016-12-03 Thread kbuild test robot
Hi Laxman,

[auto build test ERROR on tegra/for-next]
[also build test ERROR on v4.9-rc7 next-20161202]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Laxman-Dewangan/pinctrl-tegra-Add-DT-binding-for-io-pads-control/20161124-185652
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/pinctrl/tegra/pinctrl-tegra-io-pad.c: In function 
'tegra_io_pads_pinconf_get':
>> drivers/pinctrl/tegra/pinctrl-tegra-io-pad.c:124:9: error: implicit 
>> declaration of function 'tegra_io_pad_power_get_status' 
>> [-Werror=implicit-function-declaration]
  ret = tegra_io_pad_power_get_status(cfg->id);
^
   cc1: some warnings being treated as errors

vim +/tegra_io_pad_power_get_status +124 
drivers/pinctrl/tegra/pinctrl-tegra-io-pad.c

   118  dev_err(tiopi->dev,
   119  "IO pad %s does not support low 
power\n",
   120  cfg->name);
   121  return -EINVAL;
   122  }
   123  
 > 124  ret = tegra_io_pad_power_get_status(cfg->id);
   125  if (ret < 0)
   126  return ret;
   127  arg = !ret;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


cc1: error: '-march=r3000' requires '-mfp32'

2016-12-03 Thread kbuild test robot
Hi James,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   3c49de52d5647cda8b42c4255cf8a29d1e22eff5
commit: 034827c727f7f3946a18355b63995b402c226c82 MIPS: Fix -mabi=64 build of 
vdso.lds
date:   8 weeks ago
config: mips-decstation_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 034827c727f7f3946a18355b63995b402c226c82
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

>> cc1: error: '-march=r3000' requires '-mfp32'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


cc1: error: '-march=r3000' requires '-mfp32'

2016-12-03 Thread kbuild test robot
Hi James,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   3c49de52d5647cda8b42c4255cf8a29d1e22eff5
commit: 034827c727f7f3946a18355b63995b402c226c82 MIPS: Fix -mabi=64 build of 
vdso.lds
date:   8 weeks ago
config: mips-decstation_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 034827c727f7f3946a18355b63995b402c226c82
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

>> cc1: error: '-march=r3000' requires '-mfp32'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH] zram: restrict add/remove attributes to root only

2016-12-03 Thread Sergey Senozhatsky
Only root must be able to create a new zram device, therefore
hot_add attribute must have S_IRUSR mode, not S_IRUGO. Otherwise,
anyone can create a new zram device (device initialization with
the disksize attr requires root permission).

Fixes: 6566d1a32bf72 ("zram: add dynamic device add/remove functionality")
Reported-by: Steven Allen 
Cc: [4.2+]
Signed-off-by: Sergey Senozhatsky 
---
 drivers/block/zram/zram_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 5163c8f..ee03464 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1414,8 +1414,8 @@ static ssize_t hot_remove_store(struct class *class,
 }
 
 static struct class_attribute zram_control_class_attrs[] = {
-   __ATTR_RO(hot_add),
-   __ATTR_WO(hot_remove),
+   __ATTR(hot_add, 0400, hot_add_show, NULL),
+   __ATTR(hot_remove, 0200, NULL, hot_remove_store),
__ATTR_NULL,
 };
 
-- 
2.10.2



[PATCH] zram: restrict add/remove attributes to root only

2016-12-03 Thread Sergey Senozhatsky
Only root must be able to create a new zram device, therefore
hot_add attribute must have S_IRUSR mode, not S_IRUGO. Otherwise,
anyone can create a new zram device (device initialization with
the disksize attr requires root permission).

Fixes: 6566d1a32bf72 ("zram: add dynamic device add/remove functionality")
Reported-by: Steven Allen 
Cc: [4.2+]
Signed-off-by: Sergey Senozhatsky 
---
 drivers/block/zram/zram_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 5163c8f..ee03464 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1414,8 +1414,8 @@ static ssize_t hot_remove_store(struct class *class,
 }
 
 static struct class_attribute zram_control_class_attrs[] = {
-   __ATTR_RO(hot_add),
-   __ATTR_WO(hot_remove),
+   __ATTR(hot_add, 0400, hot_add_show, NULL),
+   __ATTR(hot_remove, 0200, NULL, hot_remove_store),
__ATTR_NULL,
 };
 
-- 
2.10.2



Urgent Pls

2016-12-03 Thread Dr. Andrea
Dear,

I'm Dr. Andrea Thompson, I'm seeking for investment opportunities around the 
globe and wonder if you can be of assistance.

Basically, all I need from you is sincerity, authenticity, integrity 
protection, virtue, accountability and honor which brings trust in business. As 
you already know, nothing can undermine a business relationship more completely 
than lack of trust because trust is the essential precondition upon which all 
real success depends and the key to trust is action and commitments. 
Commitments made and commitments honored.

Once you agree to this, we shall sign the Equity Investment Agreement where we 
shall state the profit sharing pattern and all other conditions.

kindly reply me to my private email: dr.andrea.thompso...@gmail.com

Waiting for your response.

Dr. Andrea Thompson .


Urgent Pls

2016-12-03 Thread Dr. Andrea
Dear,

I'm Dr. Andrea Thompson, I'm seeking for investment opportunities around the 
globe and wonder if you can be of assistance.

Basically, all I need from you is sincerity, authenticity, integrity 
protection, virtue, accountability and honor which brings trust in business. As 
you already know, nothing can undermine a business relationship more completely 
than lack of trust because trust is the essential precondition upon which all 
real success depends and the key to trust is action and commitments. 
Commitments made and commitments honored.

Once you agree to this, we shall sign the Equity Investment Agreement where we 
shall state the profit sharing pattern and all other conditions.

kindly reply me to my private email: dr.andrea.thompso...@gmail.com

Waiting for your response.

Dr. Andrea Thompson .


Re: [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-03 Thread kbuild test robot
Hi Gonglei,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.9-rc7 next-20161202]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Gonglei/crypto-add-virtio-crypto-driver/20161202-190424
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64 

All errors (new ones prefixed by >>):

   In file included from arch/sparc/include/asm/topology.h:4:0,
from include/linux/topology.h:35,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/crypto/virtio/virtio_crypto_mgr.c:21:
   drivers/crypto/virtio/virtio_crypto_common.h: In function 
'virtio_crypto_get_current_node':
>> arch/sparc/include/asm/topology_64.h:44:44: error: implicit declaration of 
>> function 'cpu_data' [-Werror=implicit-function-declaration]
#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
   ^
   drivers/crypto/virtio/virtio_crypto_common.h:116:9: note: in expansion of 
macro 'topology_physical_package_id'
 return topology_physical_package_id(smp_processor_id());
^~~~
>> arch/sparc/include/asm/topology_64.h:44:57: error: request for member 
>> 'proc_id' in something not a structure or union
#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
^
   drivers/crypto/virtio/virtio_crypto_common.h:116:9: note: in expansion of 
macro 'topology_physical_package_id'
 return topology_physical_package_id(smp_processor_id());
^~~~
   cc1: some warnings being treated as errors

vim +/cpu_data +44 arch/sparc/include/asm/topology_64.h

f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
28  
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
29  #define cpumask_of_pcibus(bus)\
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
30(pcibus_to_node(bus) == -1 ? \
e9b37512 arch/sparc/include/asm/topology_64.h Rusty Russell   2009-03-16  
31 cpu_all_mask : \
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
32 cpumask_of_node(pcibus_to_node(bus)))
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
33  
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
34  int __node_distance(int, int);
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
35  #define node_distance(a, b) __node_distance(a, b)
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
36  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
37  #else /* CONFIG_NUMA */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
38  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
39  #include 
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
40  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
41  #endif /* !(CONFIG_NUMA) */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
42  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
43  #ifdef CONFIG_SMP
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17 
@44  #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
45  #define topology_core_id(cpu) (cpu_data(cpu).core_id)
acc455cf arch/sparc/include/asm/topology_64.h chris hyser 2015-04-22  
46  #define topology_core_cpumask(cpu)(_core_sib_map[cpu])
06931e62 arch/sparc/include/asm/topology_64.h Bartosz Golaszewski 2015-05-26  
47  #define topology_sibling_cpumask(cpu) (_cpu(cpu_sibling_map, 
cpu))
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
48  #endif /* CONFIG_SMP */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
49  
3905c54f arch/sparc/include/asm/topology_64.h Stephen Rothwell2011-04-12  
50  extern cpumask_t cpu_core_map[NR_CPUS];
acc455cf arch/sparc/include/asm/topology_64.h chris hyser 2015-04-22  
51  extern cpumask_t 

Re: [PATCH v5 1/1] crypto: add virtio-crypto driver

2016-12-03 Thread kbuild test robot
Hi Gonglei,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.9-rc7 next-20161202]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Gonglei/crypto-add-virtio-crypto-driver/20161202-190424
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64 

All errors (new ones prefixed by >>):

   In file included from arch/sparc/include/asm/topology.h:4:0,
from include/linux/topology.h:35,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/crypto/virtio/virtio_crypto_mgr.c:21:
   drivers/crypto/virtio/virtio_crypto_common.h: In function 
'virtio_crypto_get_current_node':
>> arch/sparc/include/asm/topology_64.h:44:44: error: implicit declaration of 
>> function 'cpu_data' [-Werror=implicit-function-declaration]
#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
   ^
   drivers/crypto/virtio/virtio_crypto_common.h:116:9: note: in expansion of 
macro 'topology_physical_package_id'
 return topology_physical_package_id(smp_processor_id());
^~~~
>> arch/sparc/include/asm/topology_64.h:44:57: error: request for member 
>> 'proc_id' in something not a structure or union
#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
^
   drivers/crypto/virtio/virtio_crypto_common.h:116:9: note: in expansion of 
macro 'topology_physical_package_id'
 return topology_physical_package_id(smp_processor_id());
^~~~
   cc1: some warnings being treated as errors

vim +/cpu_data +44 arch/sparc/include/asm/topology_64.h

f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
28  
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
29  #define cpumask_of_pcibus(bus)\
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
30(pcibus_to_node(bus) == -1 ? \
e9b37512 arch/sparc/include/asm/topology_64.h Rusty Russell   2009-03-16  
31 cpu_all_mask : \
9d079337 arch/sparc/include/asm/topology_64.h David Miller2009-01-11  
32 cpumask_of_node(pcibus_to_node(bus)))
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
33  
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
34  int __node_distance(int, int);
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
35  #define node_distance(a, b) __node_distance(a, b)
52708d69 arch/sparc/include/asm/topology_64.h Nitin Gupta 2015-11-02  
36  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
37  #else /* CONFIG_NUMA */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
38  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
39  #include 
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
40  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
41  #endif /* !(CONFIG_NUMA) */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
42  
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
43  #ifdef CONFIG_SMP
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17 
@44  #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
45  #define topology_core_id(cpu) (cpu_data(cpu).core_id)
acc455cf arch/sparc/include/asm/topology_64.h chris hyser 2015-04-22  
46  #define topology_core_cpumask(cpu)(_core_sib_map[cpu])
06931e62 arch/sparc/include/asm/topology_64.h Bartosz Golaszewski 2015-05-26  
47  #define topology_sibling_cpumask(cpu) (_cpu(cpu_sibling_map, 
cpu))
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
48  #endif /* CONFIG_SMP */
f5e706ad include/asm-sparc/topology_64.h  Sam Ravnborg2008-07-17  
49  
3905c54f arch/sparc/include/asm/topology_64.h Stephen Rothwell2011-04-12  
50  extern cpumask_t cpu_core_map[NR_CPUS];
acc455cf arch/sparc/include/asm/topology_64.h chris hyser 2015-04-22  
51  extern cpumask_t 

[PATCH 04/19] staging: iio: isl29028: add power management support

2016-12-03 Thread Brian Masney
This patch adds power management support to the isl29028 driver.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 59 
 1 file changed, 59 insertions(+)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 4f819a8..e96a8cb 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -75,6 +75,7 @@ struct isl29028_chip {
 
int lux_scale;
enum isl29028_als_ir_mode   als_ir_mode;
+   boolsuspended;
 };
 
 static int isl29028_set_proxim_sampling(struct isl29028_chip *chip,
@@ -274,6 +275,12 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
int ret = -EINVAL;
 
mutex_lock(>lock);
+
+   if (chip->suspended) {
+   ret = -EBUSY;
+   goto write_done;
+   }
+
switch (chan->type) {
case IIO_PROXIMITY:
if (mask != IIO_CHAN_INFO_SAMP_FREQ) {
@@ -322,6 +329,8 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
dev_err(dev, "Unsupported channel type\n");
break;
}
+
+write_done:
mutex_unlock(>lock);
return ret;
 }
@@ -335,6 +344,12 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
int ret = -EINVAL;
 
mutex_lock(>lock);
+
+   if (chip->suspended) {
+   ret = -EBUSY;
+   goto read_done;
+   }
+
switch (mask) {
case IIO_CHAN_INFO_RAW:
case IIO_CHAN_INFO_PROCESSED:
@@ -374,6 +389,8 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
dev_err(dev, "mask value 0x%08lx not supported\n", mask);
break;
}
+
+read_done:
mutex_unlock(>lock);
return ret;
 }
@@ -437,6 +454,9 @@ static int isl29028_chip_init_and_power_on(struct 
isl29028_chip *chip)
ret = isl29028_set_als_scale(chip, chip->lux_scale);
if (ret < 0)
dev_err(dev, "setting als scale failed, err = %d\n", ret);
+
+   chip->suspended = false;
+
return ret;
 }
 
@@ -479,6 +499,7 @@ static int isl29028_probe(struct i2c_client *client,
 
i2c_set_clientdata(client, indio_dev);
mutex_init(>lock);
+   chip->suspended = true;
 
chip->regmap = devm_regmap_init_i2c(client, _regmap_config);
if (IS_ERR(chip->regmap)) {
@@ -530,6 +551,43 @@ static int isl29028_probe(struct i2c_client *client,
return 0;
 }
 
+static int __maybe_unused isl29028_suspend(struct device *dev)
+{
+   struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+   struct isl29028_chip *chip = iio_priv(indio_dev);
+   int ret;
+
+   mutex_lock(>lock);
+
+   ret = regmap_write(chip->regmap, ISL29028_REG_CONFIGURE, 0x0);
+   if (ret < 0)
+   dev_err(dev, "%s(): Error %d turning off chip\n", __func__,
+   ret);
+
+   chip->suspended = true;
+
+   mutex_unlock(>lock);
+
+   return ret;
+}
+
+static int __maybe_unused isl29028_resume(struct device *dev)
+{
+   struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+   struct isl29028_chip *chip = iio_priv(indio_dev);
+   int ret;
+
+   mutex_lock(>lock);
+
+   ret = isl29028_chip_init_and_power_on(chip);
+
+   mutex_unlock(>lock);
+
+   return ret;
+}
+
+static SIMPLE_DEV_PM_OPS(isl29028_pm_ops, isl29028_suspend, isl29028_resume);
+
 static const struct i2c_device_id isl29028_id[] = {
{"isl29028", 0},
{}
@@ -546,6 +604,7 @@ MODULE_DEVICE_TABLE(of, isl29028_of_match);
 static struct i2c_driver isl29028_driver = {
.driver  = {
.name = "isl29028",
+   .pm = _pm_ops,
.of_match_table = isl29028_of_match,
},
.probe   = isl29028_probe,
-- 
2.7.4



[PATCH 04/19] staging: iio: isl29028: add power management support

2016-12-03 Thread Brian Masney
This patch adds power management support to the isl29028 driver.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 59 
 1 file changed, 59 insertions(+)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 4f819a8..e96a8cb 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -75,6 +75,7 @@ struct isl29028_chip {
 
int lux_scale;
enum isl29028_als_ir_mode   als_ir_mode;
+   boolsuspended;
 };
 
 static int isl29028_set_proxim_sampling(struct isl29028_chip *chip,
@@ -274,6 +275,12 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
int ret = -EINVAL;
 
mutex_lock(>lock);
+
+   if (chip->suspended) {
+   ret = -EBUSY;
+   goto write_done;
+   }
+
switch (chan->type) {
case IIO_PROXIMITY:
if (mask != IIO_CHAN_INFO_SAMP_FREQ) {
@@ -322,6 +329,8 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
dev_err(dev, "Unsupported channel type\n");
break;
}
+
+write_done:
mutex_unlock(>lock);
return ret;
 }
@@ -335,6 +344,12 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
int ret = -EINVAL;
 
mutex_lock(>lock);
+
+   if (chip->suspended) {
+   ret = -EBUSY;
+   goto read_done;
+   }
+
switch (mask) {
case IIO_CHAN_INFO_RAW:
case IIO_CHAN_INFO_PROCESSED:
@@ -374,6 +389,8 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
dev_err(dev, "mask value 0x%08lx not supported\n", mask);
break;
}
+
+read_done:
mutex_unlock(>lock);
return ret;
 }
@@ -437,6 +454,9 @@ static int isl29028_chip_init_and_power_on(struct 
isl29028_chip *chip)
ret = isl29028_set_als_scale(chip, chip->lux_scale);
if (ret < 0)
dev_err(dev, "setting als scale failed, err = %d\n", ret);
+
+   chip->suspended = false;
+
return ret;
 }
 
@@ -479,6 +499,7 @@ static int isl29028_probe(struct i2c_client *client,
 
i2c_set_clientdata(client, indio_dev);
mutex_init(>lock);
+   chip->suspended = true;
 
chip->regmap = devm_regmap_init_i2c(client, _regmap_config);
if (IS_ERR(chip->regmap)) {
@@ -530,6 +551,43 @@ static int isl29028_probe(struct i2c_client *client,
return 0;
 }
 
+static int __maybe_unused isl29028_suspend(struct device *dev)
+{
+   struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+   struct isl29028_chip *chip = iio_priv(indio_dev);
+   int ret;
+
+   mutex_lock(>lock);
+
+   ret = regmap_write(chip->regmap, ISL29028_REG_CONFIGURE, 0x0);
+   if (ret < 0)
+   dev_err(dev, "%s(): Error %d turning off chip\n", __func__,
+   ret);
+
+   chip->suspended = true;
+
+   mutex_unlock(>lock);
+
+   return ret;
+}
+
+static int __maybe_unused isl29028_resume(struct device *dev)
+{
+   struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
+   struct isl29028_chip *chip = iio_priv(indio_dev);
+   int ret;
+
+   mutex_lock(>lock);
+
+   ret = isl29028_chip_init_and_power_on(chip);
+
+   mutex_unlock(>lock);
+
+   return ret;
+}
+
+static SIMPLE_DEV_PM_OPS(isl29028_pm_ops, isl29028_suspend, isl29028_resume);
+
 static const struct i2c_device_id isl29028_id[] = {
{"isl29028", 0},
{}
@@ -546,6 +604,7 @@ MODULE_DEVICE_TABLE(of, isl29028_of_match);
 static struct i2c_driver isl29028_driver = {
.driver  = {
.name = "isl29028",
+   .pm = _pm_ops,
.of_match_table = isl29028_of_match,
},
.probe   = isl29028_probe,
-- 
2.7.4



[PATCH 11/19] staging: iio: isl29028: made column alignment in isl29028_channels consistent

2016-12-03 Thread Brian Masney
The three info_mask_separate members OR several BIT(xxx) fields
together. This patch changes the column alignment of these fields to be
aligned at the same column to improve the overall code readability. It
also moves the { for the next channel to the next line to improve code
readability.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 0e727ba..218d165 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -419,14 +419,16 @@ static const struct iio_chan_spec isl29028_channels[] = {
{
.type = IIO_LIGHT,
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
-   BIT(IIO_CHAN_INFO_SCALE),
-   }, {
+ BIT(IIO_CHAN_INFO_SCALE),
+   },
+   {
.type = IIO_INTENSITY,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
-   }, {
+   },
+   {
.type = IIO_PROXIMITY,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
-   BIT(IIO_CHAN_INFO_SAMP_FREQ),
+ BIT(IIO_CHAN_INFO_SAMP_FREQ),
}
 };
 
-- 
2.7.4



[PATCH 01/19] staging: iio: isl29028: remove nested if statements

2016-12-03 Thread Brian Masney
There are two callers to the function isl29028_set_als_ir_mode() and
both instances use a nested if statement to only change the chip state
if it is not in the proper mode. This patch moves this check into the
isl29028_set_als_ir_mode() function to remove the nested if
statements.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 30 ++
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index aa413e5..4e35d00 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -124,6 +124,9 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip 
*chip,
 {
int ret = 0;
 
+   if (chip->als_ir_mode == mode)
+   return 0;
+
switch (mode) {
case ISL29028_MODE_ALS:
ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
@@ -160,6 +163,9 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip 
*chip,
 
/* Need to wait for conversion time if ALS/IR mode enabled */
mdelay(ISL29028_CONV_TIME_MS);
+
+   chip->als_ir_mode = mode;
+
return 0;
 }
 
@@ -223,14 +229,10 @@ static int isl29028_als_get(struct isl29028_chip *chip, 
int *als_data)
int ret;
int als_ir_data;
 
-   if (chip->als_ir_mode != ISL29028_MODE_ALS) {
-   ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS);
-   if (ret < 0) {
-   dev_err(dev,
-   "Error in enabling ALS mode err %d\n", ret);
-   return ret;
-   }
-   chip->als_ir_mode = ISL29028_MODE_ALS;
+   ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS);
+   if (ret < 0) {
+   dev_err(dev, "Error in enabling ALS mode err %d\n", ret);
+   return ret;
}
 
ret = isl29028_read_als_ir(chip, _ir_data);
@@ -256,14 +258,10 @@ static int isl29028_ir_get(struct isl29028_chip *chip, 
int *ir_data)
struct device *dev = regmap_get_device(chip->regmap);
int ret;
 
-   if (chip->als_ir_mode != ISL29028_MODE_IR) {
-   ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR);
-   if (ret < 0) {
-   dev_err(dev,
-   "Error in enabling IR mode err %d\n", ret);
-   return ret;
-   }
-   chip->als_ir_mode = ISL29028_MODE_IR;
+   ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR);
+   if (ret < 0) {
+   dev_err(dev, "Error in enabling IR mode err %d\n", ret);
+   return ret;
}
return isl29028_read_als_ir(chip, ir_data);
 }
-- 
2.7.4



[PATCH 11/19] staging: iio: isl29028: made column alignment in isl29028_channels consistent

2016-12-03 Thread Brian Masney
The three info_mask_separate members OR several BIT(xxx) fields
together. This patch changes the column alignment of these fields to be
aligned at the same column to improve the overall code readability. It
also moves the { for the next channel to the next line to improve code
readability.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 0e727ba..218d165 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -419,14 +419,16 @@ static const struct iio_chan_spec isl29028_channels[] = {
{
.type = IIO_LIGHT,
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
-   BIT(IIO_CHAN_INFO_SCALE),
-   }, {
+ BIT(IIO_CHAN_INFO_SCALE),
+   },
+   {
.type = IIO_INTENSITY,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
-   }, {
+   },
+   {
.type = IIO_PROXIMITY,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
-   BIT(IIO_CHAN_INFO_SAMP_FREQ),
+ BIT(IIO_CHAN_INFO_SAMP_FREQ),
}
 };
 
-- 
2.7.4



[PATCH 01/19] staging: iio: isl29028: remove nested if statements

2016-12-03 Thread Brian Masney
There are two callers to the function isl29028_set_als_ir_mode() and
both instances use a nested if statement to only change the chip state
if it is not in the proper mode. This patch moves this check into the
isl29028_set_als_ir_mode() function to remove the nested if
statements.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 30 ++
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index aa413e5..4e35d00 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -124,6 +124,9 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip 
*chip,
 {
int ret = 0;
 
+   if (chip->als_ir_mode == mode)
+   return 0;
+
switch (mode) {
case ISL29028_MODE_ALS:
ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
@@ -160,6 +163,9 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip 
*chip,
 
/* Need to wait for conversion time if ALS/IR mode enabled */
mdelay(ISL29028_CONV_TIME_MS);
+
+   chip->als_ir_mode = mode;
+
return 0;
 }
 
@@ -223,14 +229,10 @@ static int isl29028_als_get(struct isl29028_chip *chip, 
int *als_data)
int ret;
int als_ir_data;
 
-   if (chip->als_ir_mode != ISL29028_MODE_ALS) {
-   ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS);
-   if (ret < 0) {
-   dev_err(dev,
-   "Error in enabling ALS mode err %d\n", ret);
-   return ret;
-   }
-   chip->als_ir_mode = ISL29028_MODE_ALS;
+   ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS);
+   if (ret < 0) {
+   dev_err(dev, "Error in enabling ALS mode err %d\n", ret);
+   return ret;
}
 
ret = isl29028_read_als_ir(chip, _ir_data);
@@ -256,14 +258,10 @@ static int isl29028_ir_get(struct isl29028_chip *chip, 
int *ir_data)
struct device *dev = regmap_get_device(chip->regmap);
int ret;
 
-   if (chip->als_ir_mode != ISL29028_MODE_IR) {
-   ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR);
-   if (ret < 0) {
-   dev_err(dev,
-   "Error in enabling IR mode err %d\n", ret);
-   return ret;
-   }
-   chip->als_ir_mode = ISL29028_MODE_IR;
+   ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR);
+   if (ret < 0) {
+   dev_err(dev, "Error in enabling IR mode err %d\n", ret);
+   return ret;
}
return isl29028_read_als_ir(chip, ir_data);
 }
-- 
2.7.4



[PATCH 12/19] staging: iio: isl29028: fix comparison between signed and unsigned integers

2016-12-03 Thread Brian Masney
Fixed warning found by make W=2 to reduce the amount of build noise:

warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 218d165..23a4db8 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -80,7 +80,7 @@ static int isl29028_set_proxim_sampling(struct isl29028_chip 
*chip,
unsigned int sampling)
 {
static unsigned int prox_period[] = {800, 400, 200, 100, 75, 50, 12, 0};
-   int sel;
+   unsigned int sel;
unsigned int period = DIV_ROUND_UP(1000, sampling);
 
for (sel = 0; sel < ARRAY_SIZE(prox_period); ++sel) {
-- 
2.7.4



[PATCH 09/19] staging: iio: isl29028: change newlines to improve readability

2016-12-03 Thread Brian Masney
Add and remove newlines to improve code readability in preparation for
moving the driver out of staging.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 31 ++-
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index fa2b283..8f9295f 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -69,10 +69,8 @@ enum isl29028_als_ir_mode {
 struct isl29028_chip {
struct mutexlock;
struct regmap   *regmap;
-
unsigned intprox_sampling;
boolenable_prox;
-
int lux_scale;
enum isl29028_als_ir_mode   als_ir_mode;
boolsuspended;
@@ -89,6 +87,7 @@ static int isl29028_set_proxim_sampling(struct isl29028_chip 
*chip,
if (period >= prox_period[sel])
break;
}
+
return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
  ISL29028_CONF_PROX_SLP_MASK,
  sel << ISL29028_CONF_PROX_SLP_SH);
@@ -106,6 +105,7 @@ static int isl29028_enable_proximity(struct isl29028_chip 
*chip)
 
/* Wait for conversion to be complete for first sample */
mdelay(DIV_ROUND_UP(1000, chip->prox_sampling));
+
return 0;
 }
 
@@ -138,13 +138,11 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip 
*chip,
 ISL29028_CONF_ALS_RANGE_MASK,
 ISL29028_CONF_ALS_RANGE_HIGH_LUX);
break;
-
case ISL29028_MODE_IR:
ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
 ISL29028_CONF_ALS_IR_MODE_MASK,
 ISL29028_CONF_ALS_IR_MODE_IR);
break;
-
case ISL29028_MODE_NONE:
return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
  ISL29028_CONF_ALS_EN_MASK,
@@ -191,6 +189,7 @@ static int isl29028_read_als_ir(struct isl29028_chip *chip, 
int *als_ir)
}
 
*als_ir = ((msb & 0xF) << 8) | (lsb & 0xFF);
+
return 0;
 }
 
@@ -204,6 +203,7 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, 
int *prox)
ret = isl29028_enable_proximity(chip);
if (ret < 0)
return ret;
+
chip->enable_prox = true;
}
 
@@ -213,7 +213,9 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, 
int *prox)
ISL29028_REG_PROX_DATA, ret);
return ret;
}
+
*prox = data;
+
return 0;
 }
 
@@ -244,6 +246,7 @@ static int isl29028_als_get(struct isl29028_chip *chip, int 
*als_data)
als_ir_data = (als_ir_data * 49) / 100;
 
*als_data = als_ir_data;
+
return 0;
 }
 
@@ -257,6 +260,7 @@ static int isl29028_ir_get(struct isl29028_chip *chip, int 
*ir_data)
dev_err(dev, "Error in enabling IR mode err %d\n", ret);
return ret;
}
+
return isl29028_read_als_ir(chip, ir_data);
 }
 
@@ -284,11 +288,13 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
mask);
break;
}
+
if (val < 1 || val > 100) {
dev_err(dev,
"Samp_freq %d is not in range[1:100]\n", val);
break;
}
+
ret = isl29028_set_proxim_sampling(chip, val);
if (ret < 0) {
dev_err(dev,
@@ -296,9 +302,9 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
ret);
break;
}
+
chip->prox_sampling = val;
break;
-
case IIO_LIGHT:
if (mask != IIO_CHAN_INFO_SCALE) {
dev_err(dev,
@@ -306,20 +312,22 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
mask);
break;
}
+
if ((val != 125) && (val != 2000)) {
dev_err(dev,
"lux scale %d is invalid [125, 2000]\n", val);
break;
}
+
ret = isl29028_set_als_scale(chip, val);
if (ret < 0) {
dev_err(dev,
"Setting lux scale fail with error %d\n", ret);
break;
}
+
chip->lux_scale = val;
break;
-

[PATCH 12/19] staging: iio: isl29028: fix comparison between signed and unsigned integers

2016-12-03 Thread Brian Masney
Fixed warning found by make W=2 to reduce the amount of build noise:

warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 218d165..23a4db8 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -80,7 +80,7 @@ static int isl29028_set_proxim_sampling(struct isl29028_chip 
*chip,
unsigned int sampling)
 {
static unsigned int prox_period[] = {800, 400, 200, 100, 75, 50, 12, 0};
-   int sel;
+   unsigned int sel;
unsigned int period = DIV_ROUND_UP(1000, sampling);
 
for (sel = 0; sel < ARRAY_SIZE(prox_period); ++sel) {
-- 
2.7.4



[PATCH 09/19] staging: iio: isl29028: change newlines to improve readability

2016-12-03 Thread Brian Masney
Add and remove newlines to improve code readability in preparation for
moving the driver out of staging.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 31 ++-
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index fa2b283..8f9295f 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -69,10 +69,8 @@ enum isl29028_als_ir_mode {
 struct isl29028_chip {
struct mutexlock;
struct regmap   *regmap;
-
unsigned intprox_sampling;
boolenable_prox;
-
int lux_scale;
enum isl29028_als_ir_mode   als_ir_mode;
boolsuspended;
@@ -89,6 +87,7 @@ static int isl29028_set_proxim_sampling(struct isl29028_chip 
*chip,
if (period >= prox_period[sel])
break;
}
+
return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
  ISL29028_CONF_PROX_SLP_MASK,
  sel << ISL29028_CONF_PROX_SLP_SH);
@@ -106,6 +105,7 @@ static int isl29028_enable_proximity(struct isl29028_chip 
*chip)
 
/* Wait for conversion to be complete for first sample */
mdelay(DIV_ROUND_UP(1000, chip->prox_sampling));
+
return 0;
 }
 
@@ -138,13 +138,11 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip 
*chip,
 ISL29028_CONF_ALS_RANGE_MASK,
 ISL29028_CONF_ALS_RANGE_HIGH_LUX);
break;
-
case ISL29028_MODE_IR:
ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
 ISL29028_CONF_ALS_IR_MODE_MASK,
 ISL29028_CONF_ALS_IR_MODE_IR);
break;
-
case ISL29028_MODE_NONE:
return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
  ISL29028_CONF_ALS_EN_MASK,
@@ -191,6 +189,7 @@ static int isl29028_read_als_ir(struct isl29028_chip *chip, 
int *als_ir)
}
 
*als_ir = ((msb & 0xF) << 8) | (lsb & 0xFF);
+
return 0;
 }
 
@@ -204,6 +203,7 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, 
int *prox)
ret = isl29028_enable_proximity(chip);
if (ret < 0)
return ret;
+
chip->enable_prox = true;
}
 
@@ -213,7 +213,9 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, 
int *prox)
ISL29028_REG_PROX_DATA, ret);
return ret;
}
+
*prox = data;
+
return 0;
 }
 
@@ -244,6 +246,7 @@ static int isl29028_als_get(struct isl29028_chip *chip, int 
*als_data)
als_ir_data = (als_ir_data * 49) / 100;
 
*als_data = als_ir_data;
+
return 0;
 }
 
@@ -257,6 +260,7 @@ static int isl29028_ir_get(struct isl29028_chip *chip, int 
*ir_data)
dev_err(dev, "Error in enabling IR mode err %d\n", ret);
return ret;
}
+
return isl29028_read_als_ir(chip, ir_data);
 }
 
@@ -284,11 +288,13 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
mask);
break;
}
+
if (val < 1 || val > 100) {
dev_err(dev,
"Samp_freq %d is not in range[1:100]\n", val);
break;
}
+
ret = isl29028_set_proxim_sampling(chip, val);
if (ret < 0) {
dev_err(dev,
@@ -296,9 +302,9 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
ret);
break;
}
+
chip->prox_sampling = val;
break;
-
case IIO_LIGHT:
if (mask != IIO_CHAN_INFO_SCALE) {
dev_err(dev,
@@ -306,20 +312,22 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
mask);
break;
}
+
if ((val != 125) && (val != 2000)) {
dev_err(dev,
"lux scale %d is invalid [125, 2000]\n", val);
break;
}
+
ret = isl29028_set_als_scale(chip, val);
if (ret < 0) {
dev_err(dev,
"Setting lux scale fail with error %d\n", ret);
break;
}
+
chip->lux_scale = val;
break;
-
default:

[PATCH 10/19] staging: iio: isl29028: remove unused define ISL29028_DEV_ATTR

2016-12-03 Thread Brian Masney
The #define ISL29028_DEV_ATTR was not used so this patch removes the
unnecessary code.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 8f9295f..0e727ba 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -404,7 +404,6 @@ static 
IIO_CONST_ATTR(in_proximity_sampling_frequency_available,
"1 3 5 10 13 20 83 100");
 static IIO_CONST_ATTR(in_illuminance_scale_available, "125 2000");
 
-#define ISL29028_DEV_ATTR(name) (_dev_attr_##name.dev_attr.attr)
 #define ISL29028_CONST_ATTR(name) (_const_attr_##name.dev_attr.attr)
 static struct attribute *isl29028_attributes[] = {
ISL29028_CONST_ATTR(in_proximity_sampling_frequency_available),
-- 
2.7.4



[PATCH 07/19] staging: iio: isl29028: fix alignment of function arguments

2016-12-03 Thread Brian Masney
Two separate calls to regmap_update_bits() in isl29028_set_als_scale()
and isl29028_set_als_ir_mode() did not have their function arguments
on the next line aligned correctly to the open parenthesis. This patch
corrects the alignment.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index fe8814b..38027ee 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -115,7 +115,7 @@ static int isl29028_set_als_scale(struct isl29028_chip 
*chip, int lux_scale)
ISL29028_CONF_ALS_RANGE_LOW_LUX;
 
return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-   ISL29028_CONF_ALS_RANGE_MASK, val);
+ ISL29028_CONF_ALS_RANGE_MASK, val);
 }
 
 static int isl29028_set_als_ir_mode(struct isl29028_chip *chip,
@@ -147,7 +147,8 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip 
*chip,
 
case ISL29028_MODE_NONE:
return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-   ISL29028_CONF_ALS_EN_MASK, ISL29028_CONF_ALS_DIS);
+ ISL29028_CONF_ALS_EN_MASK,
+ ISL29028_CONF_ALS_DIS);
}
 
if (ret < 0)
-- 
2.7.4



[PATCH 05/19] staging: iio: isl29028: made alignment of #defines consistent

2016-12-03 Thread Brian Masney
The alignment of the #defines at the top of the file is not consistent.
This changes all of the defines to use consistent alignment to improve
the code readability.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 42 ++--
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index e96a8cb..d5b069e 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -27,38 +27,38 @@
 #include 
 #include 
 
-#define ISL29028_CONV_TIME_MS  100
+#define ISL29028_CONV_TIME_MS  100
 
-#define ISL29028_REG_CONFIGURE 0x01
+#define ISL29028_REG_CONFIGURE 0x01
 
-#define ISL29028_CONF_ALS_IR_MODE_ALS  0
-#define ISL29028_CONF_ALS_IR_MODE_IR   BIT(0)
-#define ISL29028_CONF_ALS_IR_MODE_MASK BIT(0)
+#define ISL29028_CONF_ALS_IR_MODE_ALS  0
+#define ISL29028_CONF_ALS_IR_MODE_IR   BIT(0)
+#define ISL29028_CONF_ALS_IR_MODE_MASK BIT(0)
 
-#define ISL29028_CONF_ALS_RANGE_LOW_LUX0
+#define ISL29028_CONF_ALS_RANGE_LOW_LUX0
 #define ISL29028_CONF_ALS_RANGE_HIGH_LUX   BIT(1)
-#define ISL29028_CONF_ALS_RANGE_MASK   BIT(1)
+#define ISL29028_CONF_ALS_RANGE_MASK   BIT(1)
 
-#define ISL29028_CONF_ALS_DIS  0
-#define ISL29028_CONF_ALS_EN   BIT(2)
-#define ISL29028_CONF_ALS_EN_MASK  BIT(2)
+#define ISL29028_CONF_ALS_DIS  0
+#define ISL29028_CONF_ALS_EN   BIT(2)
+#define ISL29028_CONF_ALS_EN_MASK  BIT(2)
 
-#define ISL29028_CONF_PROX_SLP_SH  4
-#define ISL29028_CONF_PROX_SLP_MASK(7 << ISL29028_CONF_PROX_SLP_SH)
+#define ISL29028_CONF_PROX_SLP_SH  4
+#define ISL29028_CONF_PROX_SLP_MASK(7 << ISL29028_CONF_PROX_SLP_SH)
 
-#define ISL29028_CONF_PROX_EN  BIT(7)
-#define ISL29028_CONF_PROX_EN_MASK BIT(7)
+#define ISL29028_CONF_PROX_EN  BIT(7)
+#define ISL29028_CONF_PROX_EN_MASK BIT(7)
 
-#define ISL29028_REG_INTERRUPT 0x02
+#define ISL29028_REG_INTERRUPT 0x02
 
-#define ISL29028_REG_PROX_DATA 0x08
-#define ISL29028_REG_ALSIR_L   0x09
-#define ISL29028_REG_ALSIR_U   0x0A
+#define ISL29028_REG_PROX_DATA 0x08
+#define ISL29028_REG_ALSIR_L   0x09
+#define ISL29028_REG_ALSIR_U   0x0A
 
-#define ISL29028_REG_TEST1_MODE0x0E
-#define ISL29028_REG_TEST2_MODE0x0F
+#define ISL29028_REG_TEST1_MODE0x0E
+#define ISL29028_REG_TEST2_MODE0x0F
 
-#define ISL29028_NUM_REGS  (ISL29028_REG_TEST2_MODE + 1)
+#define ISL29028_NUM_REGS  (ISL29028_REG_TEST2_MODE + 1)
 
 enum isl29028_als_ir_mode {
ISL29028_MODE_NONE = 0,
-- 
2.7.4



[PATCH 06/19] staging: iio: isl29028: made alignment of variables in struct isl29028_chip consistent

2016-12-03 Thread Brian Masney
The alignment of the variables in the struct isl29028_chip is not
consistent. This changes all of the variables to use consistent
alignment to improve the code readability.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index d5b069e..fe8814b 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -67,13 +67,13 @@ enum isl29028_als_ir_mode {
 };
 
 struct isl29028_chip {
-   struct mutexlock;
-   struct regmap   *regmap;
+   struct mutexlock;
+   struct regmap   *regmap;
 
-   unsigned intprox_sampling;
-   boolenable_prox;
+   unsigned intprox_sampling;
+   boolenable_prox;
 
-   int lux_scale;
+   int lux_scale;
enum isl29028_als_ir_mode   als_ir_mode;
boolsuspended;
 };
-- 
2.7.4



[PATCH 08/19] staging: iio: isl29028: combine isl29028_proxim_get() and isl29028_read_proxim()

2016-12-03 Thread Brian Masney
isl29028_proxim_get() checks to see if the promixity needs to be
enabled on the chip and then calls isl29028_read_proxim(). There
are no other callers of isl29028_read_proxim(). The naming between
these two functions can be confusing so this patch combines the
two to avoid the confusion.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 38027ee..fa2b283 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -200,6 +200,13 @@ static int isl29028_read_proxim(struct isl29028_chip 
*chip, int *prox)
unsigned int data;
int ret;
 
+   if (!chip->enable_prox) {
+   ret = isl29028_enable_proximity(chip);
+   if (ret < 0)
+   return ret;
+   chip->enable_prox = true;
+   }
+
ret = regmap_read(chip->regmap, ISL29028_REG_PROX_DATA, );
if (ret < 0) {
dev_err(dev, "Error in reading register %d, error %d\n",
@@ -210,19 +217,6 @@ static int isl29028_read_proxim(struct isl29028_chip 
*chip, int *prox)
return 0;
 }
 
-static int isl29028_proxim_get(struct isl29028_chip *chip, int *prox_data)
-{
-   int ret;
-
-   if (!chip->enable_prox) {
-   ret = isl29028_enable_proximity(chip);
-   if (ret < 0)
-   return ret;
-   chip->enable_prox = true;
-   }
-   return isl29028_read_proxim(chip, prox_data);
-}
-
 static int isl29028_als_get(struct isl29028_chip *chip, int *als_data)
 {
struct device *dev = regmap_get_device(chip->regmap);
@@ -362,7 +356,7 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
ret = isl29028_ir_get(chip, val);
break;
case IIO_PROXIMITY:
-   ret = isl29028_proxim_get(chip, val);
+   ret = isl29028_read_proxim(chip, val);
break;
default:
break;
-- 
2.7.4



[PATCH 10/19] staging: iio: isl29028: remove unused define ISL29028_DEV_ATTR

2016-12-03 Thread Brian Masney
The #define ISL29028_DEV_ATTR was not used so this patch removes the
unnecessary code.

Signed-off-by: Brian Masney 
---
 drivers/staging/iio/light/isl29028.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index 8f9295f..0e727ba 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -404,7 +404,6 @@ static 
IIO_CONST_ATTR(in_proximity_sampling_frequency_available,
"1 3 5 10 13 20 83 100");
 static IIO_CONST_ATTR(in_illuminance_scale_available, "125 2000");
 
-#define ISL29028_DEV_ATTR(name) (_dev_attr_##name.dev_attr.attr)
 #define ISL29028_CONST_ATTR(name) (_const_attr_##name.dev_attr.attr)
 static struct attribute *isl29028_attributes[] = {
ISL29028_CONST_ATTR(in_proximity_sampling_frequency_available),
-- 
2.7.4



  1   2   3   4   5   6   >