[PATCH] staging: android: ashmem: Fix possible deadlock in ashmem_ioctl

2018-02-27 Thread Yisheng Xie
ashmem_mutex may create a chain of dependencies like:

CPU0CPU1
 mmap syscall   ioctl syscall
 -> mmap_sem (acquired) -> ashmem_ioctl
 -> ashmem_mmap-> ashmem_mutex (acquired)
-> ashmem_mutex (try to acquire)   -> copy_from_user
  -> mmap_sem (try to acquire)

There is a lock odering problem between mmap_sem and ashmem_mutex causing
a lockdep splat[1] during a syzcaller test. This patch fixes the problem
by move copy_from_user out of ashmem_mutex.

[1] https://www.spinics.net/lists/kernel/msg2733200.html

Fixes: ce8a3a9e76d0 (staging: android: ashmem: Fix a race condition in pin 
ioctls)
Reported-by: syzbot+d7a918a7a8e1c952b...@syzkaller.appspotmail.com
Signed-off-by: Yisheng Xie 
---
 drivers/staging/android/ashmem.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 6dbba5a..8c55706 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -702,16 +702,14 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, 
unsigned long cmd,
size_t pgstart, pgend;
int ret = -EINVAL;
 
+   if (unlikely(copy_from_user(, p, sizeof(pin
+   return -EFAULT;
+
mutex_lock(_mutex);
 
if (unlikely(!asma->file))
goto out_unlock;
 
-   if (unlikely(copy_from_user(, p, sizeof(pin {
-   ret = -EFAULT;
-   goto out_unlock;
-   }
-
/* per custom, you can pass zero for len to mean "everything onward" */
if (!pin.len)
pin.len = PAGE_ALIGN(asma->size) - pin.offset;
-- 
1.7.12.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:r8188eu: use lib80211 CCMP decrypt

2018-02-27 Thread Dan Carpenter
Hm...  Sorry.  I was looking at the wrong code.

I was looking at aes_decipher() instead of rtw_aes_decrypt().  The
aes_decipher() was acceptable style (although, it's of course good that
you deleted it).  rtw_aes_decrypt() was always really really awful.

That's fine then.  Sorry again.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:r8188eu: use lib80211 CCMP decrypt

2018-02-27 Thread Ivan Safonov

On 02/26/2018 10:56 AM, Dan Carpenter wrote:

On Fri, Feb 23, 2018 at 05:57:42PM +0300, Ivan Safonov wrote:

Custom AES decrypt implementation replaced with lib80211 library.

Signed-off-by: Ivan Safonov 


The new code looks like original RTL code (really bad) so I'm guessing
you copy and pasted the code from somewhere else?
Unfortunately, your assumption is wrong. Rather, bad code is created 
because I'm not a good programmer =).


Seriously, after each patch the driver gets better, does not it?



The idea is good, but RTL code is painful to look at.
The basic idea is to replace a _small_ (or trivial) parts of the 
program, because I can not test my patches.




regards,
dan carpenter



Ivan Safonov.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/4] staging: fsl-dpaa2/eth: allow the driver to compile multi-arch

2018-02-27 Thread kbuild test robot
Hi Ioana,

I love your patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.16-rc3 next-20180227]
[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/Ioana-Radulescu/staging-fsl-mc-dpio-fsl-dpaa2-eth-Enable-multi-arch-compile/20180228-062457
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/staging/fsl-dpaa2/ethernet/../../fsl-mc/include/dpaa2-fd.h:290:16: 
>> sparse: cast from restricted __le64
>> drivers/staging/fsl-dpaa2/ethernet/../../fsl-mc/include/dpaa2-fd.h:290:16: 
>> sparse: cast to restricted __le64
>> drivers/staging/fsl-dpaa2/ethernet/../../fsl-mc/include/dpaa2-fd.h:290:16: 
>> sparse: cast from restricted __le64
>> drivers/staging/fsl-dpaa2/ethernet/../../fsl-mc/include/dpaa2-fd.h:290:16: 
>> sparse: cast to restricted __le64
>> drivers/staging/fsl-dpaa2/ethernet/../../fsl-mc/include/dpaa2-fd.h:421:30: 
>> sparse: cast truncates bits from constant value (7fff becomes 7fff)
--
>> drivers/staging/fsl-dpaa2/ethernet/dpni.c:1624:22: sparse: cast to 
>> restricted __le16
   drivers/staging/fsl-dpaa2/ethernet/dpni.c:1625:22: sparse: cast to 
restricted __le16

vim +290 drivers/staging/fsl-dpaa2/ethernet/../../fsl-mc/include/dpaa2-fd.h

d3269bdc Roy Pledge 2017-03-13  281  
d3269bdc Roy Pledge 2017-03-13  282  /**
d3269bdc Roy Pledge 2017-03-13  283   * dpaa2_sg_get_addr() - Get the address 
from SG entry
d3269bdc Roy Pledge 2017-03-13  284   * @sg: the given scatter-gathering object
d3269bdc Roy Pledge 2017-03-13  285   *
d3269bdc Roy Pledge 2017-03-13  286   * Return the address.
d3269bdc Roy Pledge 2017-03-13  287   */
d3269bdc Roy Pledge 2017-03-13  288  static inline dma_addr_t 
dpaa2_sg_get_addr(const struct dpaa2_sg_entry *sg)
d3269bdc Roy Pledge 2017-03-13  289  {
d3269bdc Roy Pledge 2017-03-13 @290 return 
le64_to_cpu((dma_addr_t)sg->addr);
d3269bdc Roy Pledge 2017-03-13  291  }
d3269bdc Roy Pledge 2017-03-13  292  
d3269bdc Roy Pledge 2017-03-13  293  /**
d3269bdc Roy Pledge 2017-03-13  294   * dpaa2_sg_set_addr() - Set the address 
in SG entry
d3269bdc Roy Pledge 2017-03-13  295   * @sg: the given scatter-gathering object
d3269bdc Roy Pledge 2017-03-13  296   * @addr: the address to be set
d3269bdc Roy Pledge 2017-03-13  297   */
d3269bdc Roy Pledge 2017-03-13  298  static inline void 
dpaa2_sg_set_addr(struct dpaa2_sg_entry *sg, dma_addr_t addr)
d3269bdc Roy Pledge 2017-03-13  299  {
d3269bdc Roy Pledge 2017-03-13  300 sg->addr = cpu_to_le64(addr);
d3269bdc Roy Pledge 2017-03-13  301  }
d3269bdc Roy Pledge 2017-03-13  302  
d3269bdc Roy Pledge 2017-03-13  303  static inline bool 
dpaa2_sg_short_len(const struct dpaa2_sg_entry *sg)
d3269bdc Roy Pledge 2017-03-13  304  {
d3269bdc Roy Pledge 2017-03-13  305 return 
!!((le16_to_cpu(sg->format_offset) >> SG_SHORT_LEN_FLAG_SHIFT)
d3269bdc Roy Pledge 2017-03-13  306 & SG_SHORT_LEN_FLAG_MASK);
d3269bdc Roy Pledge 2017-03-13  307  }
d3269bdc Roy Pledge 2017-03-13  308  
d3269bdc Roy Pledge 2017-03-13  309  /**
d3269bdc Roy Pledge 2017-03-13  310   * dpaa2_sg_get_len() - Get the length in 
SG entry
d3269bdc Roy Pledge 2017-03-13  311   * @sg: the given scatter-gathering object
d3269bdc Roy Pledge 2017-03-13  312   *
d3269bdc Roy Pledge 2017-03-13  313   * Return the length.
d3269bdc Roy Pledge 2017-03-13  314   */
d3269bdc Roy Pledge 2017-03-13  315  static inline u32 dpaa2_sg_get_len(const 
struct dpaa2_sg_entry *sg)
d3269bdc Roy Pledge 2017-03-13  316  {
d3269bdc Roy Pledge 2017-03-13  317 if (dpaa2_sg_short_len(sg))
d3269bdc Roy Pledge 2017-03-13  318 return le32_to_cpu(sg->len) & 
SG_SHORT_LEN_MASK;
d3269bdc Roy Pledge 2017-03-13  319  
d3269bdc Roy Pledge 2017-03-13  320 return le32_to_cpu(sg->len);
d3269bdc Roy Pledge 2017-03-13  321  }
d3269bdc Roy Pledge 2017-03-13  322  
d3269bdc Roy Pledge 2017-03-13  323  /**
d3269bdc Roy Pledge 2017-03-13  324   * dpaa2_sg_set_len() - Set the length in 
SG entry
d3269bdc Roy Pledge 2017-03-13  325   * @sg: the given scatter-gathering object
d3269bdc Roy Pledge 2017-03-13  326   * @len: the length to be set
d3269bdc Roy Pledge 2017-03-13  327   */
d3269bdc Roy Pledge 2017-03-13  328  static inline void dpaa2_sg_set_len(struct 
dpaa2_sg_entry *sg, u32 len)
d3269bdc Roy Pledge 2017-03-13  329  {
d3269bdc Roy Pledge 2017-03-13  330 sg->len = cpu_to_le32(len);
d3269bdc Roy Pledge 2017-03-13  331  }
d3269bdc Roy Pledge 2017-03-13  332  
d3269bdc Roy Pledge 2017-03-13  333  /**
d3269bdc Roy Pledge 2017-03-13  334   * dpaa2_sg_get_offset() - Get the offset 
in SG entry
d3269bdc Roy Pledge 2017-03-13  335   * @sg: the given scatter-gathering object
d3269bdc Roy 

[RFC PATCH] staging: fsl-mc/dpio: qbman_pull_desc_set_token() can be static

2018-02-27 Thread kbuild test robot

Fixes: 1628e2e4dc76 ("staging: fsl-mc/dpio: allow the driver to compile 
multi-arch")
Signed-off-by: Fengguang Wu 
---
 qbman-portal.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
index f57c151..7b75c93 100644
--- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
@@ -522,7 +522,7 @@ void qbman_pull_desc_set_numframes(struct qbman_pull_desc 
*d, u8 numframes)
d->numf = numframes - 1;
 }
 
-void qbman_pull_desc_set_token(struct qbman_pull_desc *d, u8 token)
+static void qbman_pull_desc_set_token(struct qbman_pull_desc *d, u8 token)
 {
d->tok = token;
 }
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Prize Notice!

2018-02-27 Thread Miriam Inaki
Microsoft Iberica S.L Lottery Intl. Program
FOREIGN SERVICE SECTION BARCELONA.
REFERENCE NUMBER:BYQCX7ZPO63
BATCH NUMBER: 2018/HZK/3NW/127

OFFICIAL WINNING NOTIFICATION.

We are pleased to inform you of the released results of the Microsoft Iberica 
S.L
Sweepstakes Promotion in conjunction with foundations for the promotion of 
software
products organized for Software users.

This Program was held in Barcelona- Spain; Wherein your email address
emerged as one of the online Winning emails in the 1st category and
therefore attracted a cash award of EUR344,000.00 and a Mac Laptop/iPhone X.
Your laptop, certificate of winnings and your cheque of (EUR344,000.00)
will be sent to your contact address in your location.

To file for claims of the release of your winnings,
Contact the Customer Service Officer with the information below:

1.FULL NAMES:
2.ADDRESS:
3.SEX:
4.AGE:
5.MARITAL STATUS:
6.OCCUPATION:
7.TELEPHONE NUMBER:
8.COUNTRY:
9. BATCH NUMBER:
10. REFERENCE NUMBER:

Email: cuservd...@excite.co.jp
Contact Person: Manuel Vizner [CSO]

Congratulations!!

Sincerely,
Mrs. Miriam Inaki
Online Coordinator
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] selftests: ion: Add simple test with the vgem driver

2018-02-27 Thread Shuah Khan
On 02/26/2018 06:48 PM, Laura Abbott wrote:
> On 02/26/2018 09:07 AM, Shuah Khan wrote:
>> On 02/19/2018 11:33 AM, Daniel Vetter wrote:
>>> On Mon, Feb 19, 2018 at 10:18:21AM -0800, Laura Abbott wrote:
 On 02/19/2018 07:31 AM, Daniel Vetter wrote:
> On Thu, Feb 15, 2018 at 05:24:45PM -0800, Laura Abbott wrote:
>> Ion is designed to be a framework used by other clients who perform
>> operations on the buffer. Use the DRM vgem client as a simple consumer.
>> In conjunction with the dma-buf sync ioctls, this tests the full 
>> attach/map
>> path for the system heap.
>>
>> Signed-off-by: Laura Abbott 
>> ---
>>    tools/testing/selftests/android/ion/Makefile  |   3 +-
>>    tools/testing/selftests/android/ion/config    |   1 +
>>    tools/testing/selftests/android/ion/ionmap_test.c | 136 
>> ++
>>    3 files changed, 139 insertions(+), 1 deletion(-)
>>    create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c
>>
>> diff --git a/tools/testing/selftests/android/ion/Makefile 
>> b/tools/testing/selftests/android/ion/Makefile
>> index 96e0c448b39d..d23b6d537d8b 100644
>> --- a/tools/testing/selftests/android/ion/Makefile
>> +++ b/tools/testing/selftests/android/ion/Makefile
>> @@ -2,7 +2,7 @@
>>    INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/
>>    CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
>> -TEST_GEN_FILES := ionapp_export ionapp_import
>> +TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
>>    all: $(TEST_GEN_FILES)
>> @@ -14,3 +14,4 @@ include ../../lib.mk
>>    $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
>>    $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
>> +$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
>> diff --git a/tools/testing/selftests/android/ion/config 
>> b/tools/testing/selftests/android/ion/config
>> index 19db6ca9aa2b..b4ad748a9dd9 100644
>> --- a/tools/testing/selftests/android/ion/config
>> +++ b/tools/testing/selftests/android/ion/config
>> @@ -2,3 +2,4 @@ CONFIG_ANDROID=y
>>    CONFIG_STAGING=y
>>    CONFIG_ION=y
>>    CONFIG_ION_SYSTEM_HEAP=y
>> +CONFIG_DRM_VGEM=y
>> diff --git a/tools/testing/selftests/android/ion/ionmap_test.c 
>> b/tools/testing/selftests/android/ion/ionmap_test.c
>> new file mode 100644
>> index ..dab36b06b37d
>> --- /dev/null
>> +++ b/tools/testing/selftests/android/ion/ionmap_test.c
>> @@ -0,0 +1,136 @@
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +
>> +#include 
>> +
>> +#include "ion.h"
>> +#include "ionutils.h"
>> +
>> +int check_vgem(int fd)
>> +{
>> +    drm_version_t version = { 0 };
>> +    char name[5];
>> +    int ret;
>> +
>> +    version.name_len = 4;
>> +    version.name = name;
>> +
>> +    ret = ioctl(fd, DRM_IOCTL_VERSION, );
>> +    if (ret)
>> +    return 1;
>> +
>> +    return strcmp(name, "vgem");
>> +}
>> +
>> +int open_vgem(void)
>> +{
>> +    int i, fd;
>> +    const char *drmstr = "/dev/dri/card";
>> +
>> +    fd = -1;
>> +    for (i = 0; i < 16; i++) {
>> +    char name[80];
>> +
>> +    sprintf(name, "%s%u", drmstr, i);
>> +
>> +    fd = open(name, O_RDWR);
>> +    if (fd < 0)
>> +    continue;
>> +
>> +    if (check_vgem(fd)) {
>> +    close(fd);
>> +    continue;
>> +    } else {
>> +    break;
>> +    }
>> +
>> +    }
>> +    return fd;
>> +}
>> +
>> +int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
>> +{
>> +    struct drm_prime_handle import_handle = { 0 };
>> +    int ret;
>> +
>> +    import_handle.fd = dma_buf_fd;
>> +    import_handle.flags = 0;
>> +    import_handle.handle = 0;
>> +
>> +    ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, _handle);
>> +    if (ret == 0)
>> +    *handle = import_handle.handle;
>> +    return ret;
>> +}
>> +
>> +void close_handle(int vgem_fd, uint32_t handle)
>> +{
>> +    struct drm_gem_close close = { 0 };
>> +
>> +    close.handle = handle;
>> +    ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, );
>> +}
>> +
>> +int main()
>> +{
>> +    int ret, vgem_fd;
>> +    struct ion_buffer_info info;
>> +    uint32_t handle = 0;
>> +    struct dma_buf_sync sync = { 0 };
>> +
>> +    info.heap_type = ION_HEAP_TYPE_SYSTEM;
>> +    info.heap_size = 4096;
>> +    info.flag_type = ION_FLAG_CACHED;
>> +
>> +    ret = 

Re: [PATCH v2] Staging: bcm2048: Fix function argument alignment in radio-bcm2048.c.

2018-02-27 Thread Greg KH
On Tue, Feb 27, 2018 at 08:32:30AM +0100, Hans Verkuil wrote:
> On 02/27/2018 02:53 AM, Quytelda Kahja wrote:
> > Hans,
> > 
> > Thank you very much for your input on the patch; however this patch
> > has already been applied to the staging tree.  Additionally:
> 
> I have no record of this being applied through linux-media. Did someone
> else pick this up? Greg perhaps?

Did I pick this up?  Oops, sorry, didn't mean to, I'll go revert it now,
sorry...

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] staging: wilc1000: fix open parenthesis mismatch issue in wilc_wlan_cfg_set()

2018-02-27 Thread Dan Carpenter
On Tue, Feb 27, 2018 at 06:53:40PM +0530, Ajay Singh wrote:
> Hi Dan,
> 
> On Tue, 27 Feb 2018 12:41:40 +0300
> Dan Carpenter  wrote:
> 
> > The first 5 patches are good, but the last 3 are not OK.
> 
> Thanks for your review comments. 
> I will resubmit the patch series by only including first 5 patches. I
> will recheck the last 3 patches and submit them separately.
> 

Greg can probably just apply the first 5 as-is.  No need to resend.

regards,
dan carpenter


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] staging: wilc1000: fix open parenthesis mismatch issue in wilc_wlan_cfg_set()

2018-02-27 Thread Ajay Singh
Hi Dan,

On Tue, 27 Feb 2018 12:41:40 +0300
Dan Carpenter  wrote:

> The first 5 patches are good, but the last 3 are not OK.

Thanks for your review comments. 
I will resubmit the patch series by only including first 5 patches. I
will recheck the last 3 patches and submit them separately.

> 
> Normally "tmp" is used as an iterator pointer or something along those
> lines.  For example, here is a good use of "tmp".
> 
>   tmp = left;
>   left = right;
>   right = tmp;
> 
> In this example, you want to store a pointer temporarily, so what else
> are you going to call it besides "tmp"?  The name "tmp" doesn't mean
> "I want a short name and I'm too lazy to think of one".
> 

Sure, I will take care of this point in subsequent patches.

Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 7/8] staging: wilc1000: fix line over 80 char in wilc_wlan_cfg_set()

2018-02-27 Thread Dan Carpenter
On Mon, Feb 26, 2018 at 10:02:01PM +0530, Ajay Singh wrote:
> Fix 'line over 80 character' issue found by checkpatch.pl script.
> 
> Signed-off-by: Ajay Singh 
> ---
>  drivers/staging/wilc1000/wilc_wlan.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
> b/drivers/staging/wilc1000/wilc_wlan.c
> index 223bf8b..acf7591 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -1230,6 +1230,8 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, 
> u16 wid, u8 *buffer,
>   wilc->cfg_frame_offset = offset;
>  
>   if (commit) {
> + unsigned long tmp = msecs_to_jiffies(CFG_PKTS_TIMEOUT);
> +
>   netdev_dbg(vif->ndev,
>  "[WILC]PACKET Commit with sequence number %d\n",
>  wilc->cfg_seq_no);
> @@ -1239,8 +1241,7 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, 
> u16 wid, u8 *buffer,
>   if (wilc_wlan_cfg_commit(vif, WILC_CFG_SET, drv_handler))
>   ret_size = 0;
>  
> - if (!wait_for_completion_timeout(>cfg_event,
> -  
> msecs_to_jiffies(CFG_PKTS_TIMEOUT))) {
> + if (!wait_for_completion_timeout(>cfg_event, tmp)) {


Also, it's not just the variable name I have an issue with.  I like that
I can see CFG_PKTS_TIMEOUT directly instead of having to look for it a
few lines back.  Don't add unecessary indirection.

So just leave this one as-is.  Or flip the "if (commit) " condition
around and do:

if (!commit)
return ret_size;

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] staging: wilc1000: fix open parenthesis mismatch issue in wilc_wlan_cfg_set()

2018-02-27 Thread Dan Carpenter
The first 5 patches are good, but the last 3 are not OK.

Normally "tmp" is used as an iterator pointer or something along those
lines.  For example, here is a good use of "tmp".

tmp = left;
left = right;
right = tmp;

In this example, you want to store a pointer temporarily, so what else
are you going to call it besides "tmp"?  The name "tmp" doesn't mean
"I want a short name and I'm too lazy to think of one".

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 7/8] staging: wilc1000: fix line over 80 char in wilc_wlan_cfg_set()

2018-02-27 Thread Dan Carpenter
On Mon, Feb 26, 2018 at 10:02:01PM +0530, Ajay Singh wrote:
> Fix 'line over 80 character' issue found by checkpatch.pl script.
> 
> Signed-off-by: Ajay Singh 
> ---
>  drivers/staging/wilc1000/wilc_wlan.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
> b/drivers/staging/wilc1000/wilc_wlan.c
> index 223bf8b..acf7591 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -1230,6 +1230,8 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, 
> u16 wid, u8 *buffer,
>   wilc->cfg_frame_offset = offset;
>  
>   if (commit) {
> + unsigned long tmp = msecs_to_jiffies(CFG_PKTS_TIMEOUT);

Again.  This "tmp" is a bad name here.  "tmp" can be a good name, and
I use it all the time, but *here* it is a bad name.

regards,
dan carpenter


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 6/8] staging: wilc1000: fix line over 80 char in wilc_wlan_handle_rxq()

2018-02-27 Thread Dan Carpenter
On Mon, Feb 26, 2018 at 10:02:00PM +0530, Ajay Singh wrote:
> Fix 'line over 80 character' issue found by checkpatch.pl script.
> Refactor wilc_wlan_handle_rxq() code to remove the checkpatch.pl
> warnings.
> 
> Signed-off-by: Ajay Singh 
> ---
>  drivers/staging/wilc1000/wilc_wlan.c | 46 
> 
>  1 file changed, 25 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
> b/drivers/staging/wilc1000/wilc_wlan.c
> index 74b80ad..223bf8b 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -798,6 +798,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
>   u32 header;
>   u32 pkt_len, pkt_offset, tp_len;
>   int is_cfg_packet;
> + int tmp;
>  

Heh.  Nope.  Don't do this.  You've just create a "tmp" variable to hold
many different types of random long values...  It makes the code less
readable.

Just break it up into separate functions.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] media: imx: Don't initialize vars that won't be used

2018-02-27 Thread Philipp Zabel
On Mon, 2018-02-26 at 08:40 -0500, Mauro Carvalho Chehab wrote:
> As reported by gcc:
> 
>   + drivers/staging/media/imx/imx-media-csi.c: warning: variable 'input_fi' 
> set but not used [-Wunused-but-set-variable]:  => 671:33
>   + drivers/staging/media/imx/imx-media-csi.c: warning: variable 'pinctrl' 
> set but not used [-Wunused-but-set-variable]:  => 1742:18
> 
> input_fi is not used, so just remove it.
> 
> However, pinctrl should be used, as it devm_pinctrl_get_select_default()
> is declared with attribute warn_unused_result. What's missing there
> is an error handling code, in case it fails. Add it.
> 
> Signed-off-by: Mauro Carvalho Chehab 

Reviewed-by: Philipp Zabel 

regards
Philipp
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel