linux-5.3-rc4/drivers/staging/comedi/drivers/dt3000.c:373: (error) Signed integer overflow for expression 'divider*base'

2019-08-12 Thread David Binderman
Hello there,

Source code is

prescale = 15;
base = timer_base * (1 << prescale);
divider = 65535;
*nanosec = divider * base;

timer_base seems to be 500 or 100. 
nanosec is a pointer to int, so it can only hold about 2,000,000,000 
nanoseconds, or about 2 seconds.

Suggest rework code to use longs. 

Regards

David Binderman


time-_Base seems to be 50 or 100.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: iio: accel: adis16240: Improve readability on write_raw function

2019-08-12 Thread Jonathan Cameron
On Sun, 11 Aug 2019 13:47:04 -0300
Rodrigo Ribeiro  wrote:

> Em dom, 11 de ago de 2019 às 05:43, Jonathan Cameron
>  escreveu:
> >
> > On Sat, 10 Aug 2019 12:00:58 -0300
> > Rodrigo  wrote:
> >  
> > > From: Rodrigo Carvalho 
> > >
> > > Improve readability by using GENMASK macro, changing switch statement
> > > by if statement and removing unnecessary local variables.  
> >  
> 
> Hi Jonathan. Thanks for reviewing!
> 
> > From your description it sounds like multiple changes in one patch.
> > Always preferable to have one type of change in a patch and more
> > small patches.
> >
> > Based on comments below, I would leave the switch statement alone,
> > but put in your GENMASK change as that one is good and gets
> > rid of the odd local variable 'bits' as well :)
> >
> > Thanks,
> >
> > Jonathan
> >
> >  
> > >
> > > Signed-off-by: Rodrigo Ribeiro Carvalho 
> > > ---
> > >  drivers/staging/iio/accel/adis16240.c | 16 +++-
> > >  1 file changed, 7 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/staging/iio/accel/adis16240.c 
> > > b/drivers/staging/iio/accel/adis16240.c
> > > index 62f4b3b1b457..68f165501389 100644
> > > --- a/drivers/staging/iio/accel/adis16240.c
> > > +++ b/drivers/staging/iio/accel/adis16240.c
> > > @@ -309,17 +309,15 @@ static int adis16240_write_raw(struct iio_dev 
> > > *indio_dev,
> > >  long mask)
> > >  {
> > >   struct adis *st = iio_priv(indio_dev);
> > > - int bits = 10;
> > > - s16 val16;
> > > + int m;
> > >   u8 addr;
> > >
> > > - switch (mask) {
> > > - case IIO_CHAN_INFO_CALIBBIAS:
> > > - val16 = val & ((1 << bits) - 1);
> > > - addr = adis16240_addresses[chan->scan_index][0];
> > > - return adis_write_reg_16(st, addr, val16);
> > > - }
> > > - return -EINVAL;
> > > + if (mask != IIO_CHAN_INFO_CALIBBIAS)
> > > + return -EINVAL;  
> >
> > Hmm. We generally encourage the use of switch statements in these
> > cases because they reduce churn as new features are added.
> >
> > In this particular case, we don't have any control of sampling frequency
> > in the driver, but the hardware appears to support it (table 23 on the
> > datasheet).  
> 
> On drivers of same kind out of staging (adis16209 and adis16201), sampling
> frequency writing are not implemented, even though datasheets suggest a 
> register
> writing for this. I can try to implement if it is a good one.

I would be a bit nervous about doing so if you don't have
hardware, and we can't find anyone who is setup to test the device.

Obviously if you can get it tested one way or the other, it would be good
to add support.


Thanks,

J

> 
> > > +
> > > + m = GENMASK(9, 0);
> > > + addr = adis16240_addresses[chan->scan_index][0];
> > > + return adis_write_reg_16(st, addr, val & m);  
> > Why the local variable m?  Can we not just do
> >
> > return adis_write_reg_16(st, addr, val & GENMASK(9, 0));
> >
> > If anything I think that is a little more readable than your
> > version.  There is a reasonable argument for just having
> > addr inline as well.
> >
> > return adis_write_reg_16(st,
> >  adis16240_addresses[chan->scan_index][0],
> >  val & GENMASK(9, 0));
> >
> > However, given I'm suggesting you leave it as a switch statement, it
> > will be too long with addr inline.
> >  
> > >  }
> > >
> > >  static const struct iio_chan_spec adis16240_channels[] = {  
> >  
> 
> Regards,
> Rodrigo


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


Re: linux-5.3-rc4/drivers/staging/comedi/drivers/dt3000.c:373: (error) Signed integer overflow for expression 'divider*base'

2019-08-12 Thread Ian Abbott

On 12/08/2019 08:37, David Binderman wrote:

Hello there,

Source code is

 prescale = 15;
 base = timer_base * (1 << prescale);
 divider = 65535;
 *nanosec = divider * base;

timer_base seems to be 500 or 100.
nanosec is a pointer to int, so it can only hold about 2,000,000,000 
nanoseconds, or about 2 seconds.


Thanks for the report.

I couldn't reproduce the error with the compiler version I was using, 
but I can see that it is likely to result in an arithmetic overflow.


I think the main problem is that the line (in (dt3k_ns_to_timer()):

  base = timer_base * (1 << prescale);

should be:

  base = timer_base * (prescale + 1);

which matches the earlier instance of this calculation in the same function.

In practice, these lines of code should never be reached due to earlier 
range checks in dt3k_ai_cmdtest().



Suggest rework code to use longs.


It wouldn't do any harm to change the `int` variables to `unsigned int`.



Regards

David Binderman


time-_Base seems to be 50 or 100.




--
-=( Ian Abbott  || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:)=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: comedi: dt3000: Fix signed integer overflow 'divider * base'

2019-08-12 Thread Ian Abbott
In `dt3k_ns_to_timer()` the following lines near the end of the function
result in a signed integer overflow:

prescale = 15;
base = timer_base * (1 << prescale);
divider = 65535;
*nanosec = divider * base;

(`divider`, `base` and `prescale` are type `int`, `timer_base` and
`*nanosec` are type `unsigned int`.  The value of `timer_base` will be
either 50 or 100.)

The main reason for the overflow is that the calculation for `base` is
completely wrong.  It should be:

base = timer_base * (prescale + 1);

which matches an earlier instance of this calculation in the same
function.

Reported-by: David Binderman 
Cc: 
Signed-off-by: Ian Abbott 
---
N.B. Greg: The original report suggested an actual build error, so
may be prudent to queue this on your 'staging-linus' queue.

 drivers/staging/comedi/drivers/dt3000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/dt3000.c 
b/drivers/staging/comedi/drivers/dt3000.c
index 2edf3ee91300..4ad176fc14ad 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -368,7 +368,7 @@ static int dt3k_ns_to_timer(unsigned int timer_base, 
unsigned int *nanosec,
}
 
prescale = 15;
-   base = timer_base * (1 << prescale);
+   base = timer_base * (prescale + 1);
divider = 65535;
*nanosec = divider * base;
return (prescale << 16) | (divider);
-- 
2.20.1

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


[PATCH] staging: comedi: dt3000: Fix rounding up of timer divisor

2019-08-12 Thread Ian Abbott
`dt3k_ns_to_timer()` determines the prescaler and divisor to use to
produce a desired timing period.  It is influenced by a rounding mode
and can round the divisor up, down, or to the nearest value.  However,
the code for rounding up currently does the same as rounding down!  Fix
ir by using the `DIV_ROUND_UP()` macro to calculate the divisor when
rounding up.

Also, change the types of the `divider`, `base` and `prescale` variables
from `int` to `unsigned int` to avoid mixing signed and unsigned types
in the calculations.

Also fix a typo in a nearby comment: "improvment" => "improvement".

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/dt3000.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt3000.c 
b/drivers/staging/comedi/drivers/dt3000.c
index 2edf3ee91300..8621e3833ad5 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -342,9 +342,9 @@ static irqreturn_t dt3k_interrupt(int irq, void *d)
 static int dt3k_ns_to_timer(unsigned int timer_base, unsigned int *nanosec,
unsigned int flags)
 {
-   int divider, base, prescale;
+   unsigned int divider, base, prescale;
 
-   /* This function needs improvment */
+   /* This function needs improvement */
/* Don't know if divider==0 works. */
 
for (prescale = 0; prescale < 16; prescale++) {
@@ -358,7 +358,7 @@ static int dt3k_ns_to_timer(unsigned int timer_base, 
unsigned int *nanosec,
divider = (*nanosec) / base;
break;
case CMDF_ROUND_UP:
-   divider = (*nanosec) / base;
+   divider = DIV_ROUND_UP(*nanosec, base);
break;
}
if (divider < 65536) {
-- 
2.20.1

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


Re: [PATCH 0/7] media: cedrus: Improvements/cleanup

2019-08-12 Thread Hans Verkuil
On 5/30/19 11:15 PM, Jernej Skrabec wrote:
> Here is first batch of random Cedrus improvements/cleanups. Only patch 2
> has a change which raises a question about H264 controls.
> 
> Changes were tested on H3 SoC using modified ffmpeg and Kodi.
> 
> Please take a look.

This has been sitting in patchwork for quite some time. I've updated the
status of the various patches and most needed extra work.

It seems that patches 4/7 and 5/7 are OK. Maxime, can you please confirm
that these two are still valid? They apply cleanly on the latest master
at least, but since they are a bit old I prefer to have confirmation that
it's OK to merge them.

Regards,

Hans

> 
> Best regards,
> Jernej
> 
> Jernej Skrabec (7):
>   media: cedrus: Disable engine after each slice decoding
>   media: cedrus: Fix H264 default reference index count
>   media: cedrus: Fix decoding for some H264 videos
>   media: cedrus: Remove dst_bufs from context
>   media: cedrus: Don't set chroma size for scale & rotation
>   media: cedrus: Add infra for extra buffers connected to capture
> buffers
>   media: cedrus: Improve H264 memory efficiency
> 
>  drivers/staging/media/sunxi/cedrus/cedrus.h   |  12 +-
>  .../staging/media/sunxi/cedrus/cedrus_h264.c  | 115 --
>  .../staging/media/sunxi/cedrus/cedrus_hw.c|   4 +-
>  .../staging/media/sunxi/cedrus/cedrus_video.c |  25 ++--
>  4 files changed, 68 insertions(+), 88 deletions(-)
> 

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


Re: [PATCH 0/7] media: cedrus: Improvements/cleanup

2019-08-12 Thread Jernej Škrabec
Dne ponedeljek, 12. avgust 2019 ob 14:12:21 CEST je Hans Verkuil napisal(a):
> On 5/30/19 11:15 PM, Jernej Skrabec wrote:
> > Here is first batch of random Cedrus improvements/cleanups. Only patch 2
> > has a change which raises a question about H264 controls.
> > 
> > Changes were tested on H3 SoC using modified ffmpeg and Kodi.
> > 
> > Please take a look.
> 
> This has been sitting in patchwork for quite some time. I've updated the
> status of the various patches and most needed extra work.
> 
> It seems that patches 4/7 and 5/7 are OK. Maxime, can you please confirm
> that these two are still valid? They apply cleanly on the latest master
> at least, but since they are a bit old I prefer to have confirmation that
> it's OK to merge them.

I'm not sure about patch 4, IIRC Boris Brezillon also wants to improve that 
area in separate series, but patch 5 should be safe to merge.

Anyway, I didn't post new version because I'm waiting on close-to-be-merged 
H264 and HEVC patch series to be actually merged.

Best regards,
Jernej

> 
> Regards,
> 
>   Hans
> 
> > Best regards,
> > Jernej
> > 
> > Jernej Skrabec (7):
> >   media: cedrus: Disable engine after each slice decoding
> >   media: cedrus: Fix H264 default reference index count
> >   media: cedrus: Fix decoding for some H264 videos
> >   media: cedrus: Remove dst_bufs from context
> >   media: cedrus: Don't set chroma size for scale & rotation
> >   media: cedrus: Add infra for extra buffers connected to capture
> >   
> > buffers
> >   
> >   media: cedrus: Improve H264 memory efficiency
> >  
> >  drivers/staging/media/sunxi/cedrus/cedrus.h   |  12 +-
> >  .../staging/media/sunxi/cedrus/cedrus_h264.c  | 115 --
> >  .../staging/media/sunxi/cedrus/cedrus_hw.c|   4 +-
> >  .../staging/media/sunxi/cedrus/cedrus_video.c |  25 ++--
> >  4 files changed, 68 insertions(+), 88 deletions(-)




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


Good day to you,

2019-08-12 Thread Dr. Thomas Robert
Good day to you,

I have decided to contact you through this medium after reviewing your
Honorable and reputable profile and it is my belief that with your
Position as a professional in your sector/ Country that you will be
In position to present us with solid investment opportunities in your
Country, sector and other areas of investment.

Presently I am representing a Private Group of Investors who are
Royalties and Political Figure in their Countries as their PRIVATE
FAMILY WEALTH MANAGER and my group of Investors with access to
Substantial intended investment capital which they would like to see
Their funds and asset relocated and re-invested in your Country/
Sector with your credible and reputable assistance. We are ready to
Provide you, your partners and clients with private investment finance
Either as Joint Venture Partnership project financing or as Private
Investment Loans to enable you, your partners and clients to establish
New projects or improve, expand and actualize your existing investment
Projects and at the same time you will be in total control of the bulk
Available investment capital as their FUND PORTFOLIO MANAGER in your
Country/ Region and you will oversee all Investment ventures within
Your Region.

We will conduct all of our investment transactions discretely in a
100% legal manner and you, your client and partners will have the
Opportunity to confirm and receive the due Investment funds through a
Prime Bank. AT THE SAME TIME WE WILL PAY YOU A 2% BROKER? COMMISSION
IF YOU INTRODUCE A CREDIBLE PROJECT OWNER WHO IS INTERESTED AND IN
NEED OF CREDIBLE FINANCING FOR HIS OR HER PROJECT.

Let me know if you have a solid investment plan that needs credible
Investment financing and you can email me your proposed project
Details directly, along with the executive project summary/ plan and I
Will provide you with details, documents and picture ID to
Authenticate our investment offer.

Regards,

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


Re: [PATCH v2] PCI: hv: Fix panic by calling hv_pci_remove_slots() earlier

2019-08-12 Thread Lorenzo Pieralisi
On Tue, Aug 06, 2019 at 08:41:17PM +, Dexuan Cui wrote:
> > From: linux-hyperv-ow...@vger.kernel.org
> >  On Behalf Of Bjorn Helgaas
> > Sent: Tuesday, August 6, 2019 1:16 PM
> > To: Dexuan Cui 
> > 
> > Thanks for updating this.  But you didn't update the subject line,
> > which is really still a little too low-level.  Maybe Lorenzo will fix
> > this.  Something like this, maybe?
> > 
> >   PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it
> 
> This is better. Thanks!
> 
> I hope Lorenzo can help to fix this so I could avoid a v3. :-)

You should have fixed it yourself, this time I will.

Thanks,
Lorenzo


Re: [PATCH 1/7] media: cedrus: Disable engine after each slice decoding

2019-08-12 Thread Ezequiel Garcia
Hi Jernej,

On Mon, 2019-06-03 at 13:38 +0200, Maxime Ripard wrote:
> Hi,
> 
> On Thu, May 30, 2019 at 11:15:10PM +0200, Jernej Skrabec wrote:
> > libvdpau-sunxi always disables engine after each decoded slice.
> > Do same in Cedrus driver.
> > 
> > Presumably this also lowers power consumption which is always nice.
> > 
> > Signed-off-by: Jernej Skrabec 
> 
> Is it fixing anything though?
> 
> I indeed saw that cedar did disable it everytime, but I couldn't find
> a reason why.
> 
> Also, the power management improvement would need to be measured, it
> can even create the opposite situation where the device will draw more
> current from being woken up than if it had just remained disabled.
> 

While reviewing this, I'm noticing that cedrus_engine_disable can
be marked for static storage (with or without this patch).

Regards,
Eze

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


Re: [PATCH 4/7] media: cedrus: Remove dst_bufs from context

2019-08-12 Thread Ezequiel Garcia
On Thu, 2019-05-30 at 23:15 +0200, Jernej Skrabec wrote:
> This array is just duplicated capture buffer queue. Remove it and adjust
> code to look into capture buffer queue instead.
> 
> Signed-off-by: Jernej Skrabec 
> ---
>  drivers/staging/media/sunxi/cedrus/cedrus.h   |  4 +---
>  .../staging/media/sunxi/cedrus/cedrus_h264.c  |  4 ++--
>  .../staging/media/sunxi/cedrus/cedrus_video.c | 22 ---
>  3 files changed, 3 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h 
> b/drivers/staging/media/sunxi/cedrus/cedrus.h
> index 3f476d0fd981..d8e6777e5e27 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus.h
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
> @@ -100,8 +100,6 @@ struct cedrus_ctx {
>   struct v4l2_ctrl_handlerhdl;
>   struct v4l2_ctrl**ctrls;
>  
> - struct vb2_buffer   *dst_bufs[VIDEO_MAX_FRAME];
> -
>   union {
>   struct {
>   void*mv_col_buf;
> @@ -187,7 +185,7 @@ static inline dma_addr_t cedrus_dst_buf_addr(struct 
> cedrus_ctx *ctx,
>   if (index < 0)
>   return 0;
>  
> - buf = ctx->dst_bufs[index];
> + buf = ctx->fh.m2m_ctx->cap_q_ctx.q.bufs[index];

I think you can use v4l2_m2m_get_dst_vq() to access the queue,
and vb2_get_buffer() to access buffers in a vb2 queue.

>   return buf ? cedrus_buf_addr(buf, &ctx->dst_fmt, plane) : 0;
>  }
>  
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c 
> b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> index d0ee3f90ff46..b2290f98d81a 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> @@ -119,7 +119,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx 
> *ctx,
>   if (buf_idx < 0)
>   continue;
>  
> - cedrus_buf = vb2_to_cedrus_buffer(ctx->dst_bufs[buf_idx]);
> + cedrus_buf = vb2_to_cedrus_buffer(cap_q->bufs[buf_idx]);

Ditto about vb2_get_buffer.

>   position = cedrus_buf->codec.h264.position;
>   used_dpbs |= BIT(position);
>  
> @@ -194,7 +194,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
>   if (buf_idx < 0)
>   continue;
>  
> - ref_buf = to_vb2_v4l2_buffer(ctx->dst_bufs[buf_idx]);
> + ref_buf = to_vb2_v4l2_buffer(cap_q->bufs[buf_idx]);

Ditto about vb2_get_buffer.

With those changes:

Reviewed-by: Ezequiel Garcia 

Thanks,
Ezequiel

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


Re: [PATCH 0/7] media: cedrus: Improvements/cleanup

2019-08-12 Thread Maxime Ripard
Hi!

On Mon, Aug 12, 2019 at 02:12:21PM +0200, Hans Verkuil wrote:
> On 5/30/19 11:15 PM, Jernej Skrabec wrote:
> > Here is first batch of random Cedrus improvements/cleanups. Only patch 2
> > has a change which raises a question about H264 controls.
> >
> > Changes were tested on H3 SoC using modified ffmpeg and Kodi.
> >
> > Please take a look.
>
> This has been sitting in patchwork for quite some time. I've updated the
> status of the various patches and most needed extra work.
>
> It seems that patches 4/7 and 5/7 are OK. Maxime, can you please confirm
> that these two are still valid? They apply cleanly on the latest master
> at least, but since they are a bit old I prefer to have confirmation that
> it's OK to merge them.

Yes, you can definitely merge those.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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


Re: [PATCH 01/11] staging: rtl8712: _r8712_init_xmit_priv(): Change return values and type

2019-08-12 Thread Greg KH
On Fri, Aug 09, 2019 at 10:53:43AM +0530, Nishka Dasgupta wrote:
> Change the return values in _r8712_init_xmit_priv from _SUCCESS/_FAIL to
> 0/-ENOMEM respectively. Change return type from sint to int.
> 
> Signed-off-by: Nishka Dasgupta 

I only received 9 patches in this series.  I'll try to apply these, but
if they fail, please fix up your tree, and resend the remaining ones.

thanks,

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


Re: [PATCH] staging: drivers: rtl8712: removing unnecessary parenthesis

2019-08-12 Thread Greg KH
On Fri, Aug 09, 2019 at 11:18:23PM -0400, Hugo Eduardo Ziviani wrote:
> Fix checkpatch error "CHECK: Remove unecessary parenthesis in 
> drivers/staging/rtl8712/rtl871x_mlme.c"
> 
> Signed-off-by: Hugo Eduardo Ziviani 
> ---
>  drivers/staging/rtl8712/rtl871x_mlme.c | 89 +-
>  1 file changed, 44 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
> b/drivers/staging/rtl8712/rtl871x_mlme.c
> index b34f9919cd93..cddb24242ace 100644
> --- a/drivers/staging/rtl8712/rtl871x_mlme.c
> +++ b/drivers/staging/rtl8712/rtl871x_mlme.c
> @@ -45,9 +45,9 @@ int r8712_init_mlme_priv(struct _adapter *padapter)
>   /* Maybe someday we should rename this variable to "active_mode"(Jeff)*/
>   pmlmepriv->passive_mode = 1; /* 1: active, 0: passive. */
>   spin_lock_init(&pmlmepriv->lock);
> - spin_lock_init(&(pmlmepriv->lock2));
> - _init_queue(&(pmlmepriv->free_bss_pool));
> - _init_queue(&(pmlmepriv->scanned_queue));
> + spin_lock_init(&pmlmepriv->lock2);
> + _init_queue(&pmlmepriv->free_bss_pool);
> + _init_queue(&pmlmepriv->scanned_queue);
>   set_scanned_network_val(pmlmepriv, 0);
>   memset(&pmlmepriv->assoc_ssid, 0, sizeof(struct ndis_802_11_ssid));
>   pbuf = kmalloc_array(MAX_BSS_CNT, sizeof(struct wlan_network),
> @@ -57,9 +57,9 @@ int r8712_init_mlme_priv(struct _adapter *padapter)
>   pmlmepriv->free_bss_buf = pbuf;
>   pnetwork = (struct wlan_network *)pbuf;
>   for (i = 0; i < MAX_BSS_CNT; i++) {
> - INIT_LIST_HEAD(&(pnetwork->list));
> - list_add_tail(&(pnetwork->list),
> -  &(pmlmepriv->free_bss_pool.queue));
> + INIT_LIST_HEAD(&pnetwork->list);
> + list_add_tail(&pnetwork->list,
> + &pmlmepriv->free_bss_pool.queue);
>   pnetwork++;
>   }
>   pmlmepriv->sitesurveyctrl.last_rx_pkts = 0;
> @@ -93,7 +93,7 @@ static void _free_network(struct mlme_priv *pmlmepriv,
>  {
>   u32 curr_time, delta_time;
>   unsigned long irqL;
> - struct  __queue *free_queue = &(pmlmepriv->free_bss_pool);
> + struct  __queue *free_queue = &pmlmepriv->free_bss_pool;
>  
>   if (!pnetwork)
>   return;
> @@ -220,8 +220,8 @@ int r8712_is_same_ibss(struct _adapter *adapter, struct 
> wlan_network *pnetwork)
>   int ret = true;
>   struct security_priv *psecuritypriv = &adapter->securitypriv;
>  
> - if ((psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_) &&
> - (pnetwork->network.Privacy == cpu_to_le32(0)))
> + if (psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_ &&
> + pnetwork->network.Privacy == cpu_to_le32(0))
>   ret = false;
>   else if ((psecuritypriv->PrivacyAlgrthm == _NO_PRIVACY_) &&
>(pnetwork->network.Privacy == cpu_to_le32(1)))
> @@ -286,7 +286,7 @@ static void update_network(struct wlan_bssid_ex *dst,
>   struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
>  
>   if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) &&
> - is_same_network(&(padapter->mlmepriv.cur_network.network), src)) {
> + is_same_network(&padapter->mlmepriv.cur_network.network, src)) {
>   if (padapter->recvpriv.signal_qual_data.total_num++ >=
>   PHY_LINKQUALITY_SLID_WIN_MAX) {
>   padapter->recvpriv.signal_qual_data.total_num =
> @@ -318,8 +318,8 @@ static void update_current_network(struct _adapter 
> *adapter,
>  {
>   struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
>  
> - if (is_same_network(&(pmlmepriv->cur_network.network), pnetwork)) {
> - update_network(&(pmlmepriv->cur_network.network),
> + if (is_same_network(&pmlmepriv->cur_network.network, pnetwork)) {
> + update_network(&pmlmepriv->cur_network.network,
>  pnetwork, adapter);
>   r8712_update_protection(adapter,
>  (pmlmepriv->cur_network.network.IEs) +
> @@ -428,8 +428,8 @@ static int is_desired_network(struct _adapter *adapter,
>   return true;
>   return false;
>   }
> - if ((psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_) &&
> - (pnetwork->network.Privacy == 0))
> + if (psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_ &&
> + pnetwork->network.Privacy == 0)
>   bselected = false;
>   if (check_fwstate(&adapter->mlmepriv, WIFI_ADHOC_STATE)) {
>   if (pnetwork->network.InfrastructureMode !=
> @@ -486,7 +486,7 @@ void r8712_survey_event_callback(struct _adapter 
> *adapter, u8 *pbuf)
>   spin_lock_irqsave(&pmlmepriv->lock2, flags);
>   /* update IBSS_network 's timestamp */
>   if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
> - if (!memcmp(&(pmlmepriv->cur_network.network.MacAddress),
> + if (!memcmp(&pmlmepriv->cur_network.network.Mac

Re: [PATCH v3] ARM: dts: tegra30: Connect SMMU with Video Decoder Engine

2019-08-12 Thread Dmitry Osipenko
23.06.2019 20:07, Dmitry Osipenko пишет:
> Enable IOMMU support for the video decoder.
> 
> Signed-off-by: Dmitry Osipenko 
> ---
> 
> No changes since v1.
> 
>  arch/arm/boot/dts/tegra30.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
> index 934caa83c8db..ce162125e7bf 100644
> --- a/arch/arm/boot/dts/tegra30.dtsi
> +++ b/arch/arm/boot/dts/tegra30.dtsi
> @@ -424,6 +424,7 @@
>   clocks = <&tegra_car TEGRA30_CLK_VDE>;
>   reset-names = "vde", "mc";
>   resets = <&tegra_car 61>, <&mc TEGRA30_MC_RESET_VDE>;
> + iommus = <&mc TEGRA_SWGROUP_VDE>;
>   };
>  
>   apbmisc@7800 {
> 

Hello Thierry,

Will be awesome if you could pick up this and [1][2] for v5.4. The rest of the 
VDE patches
are already applied by the media maintainers in linux-next, please note that 
[2] is required
to avoid problems caused by the notorious implicit IOMMU backing. Thanks in 
advance!

[1] http://patchwork.ozlabs.org/patch/1120864/
[2] http://patchwork.ozlabs.org/project/linux-tegra/list/?series=115608
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed()

2019-08-12 Thread Gao Xiang
As a helper in erofs_fs.h, erofs_inode_is_data_compressed()
should be inlined.

Signed-off-by: Gao Xiang 
---
 drivers/staging/erofs/erofs_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
index e82e833985e4..8dc2a75e478f 100644
--- a/drivers/staging/erofs/erofs_fs.h
+++ b/drivers/staging/erofs/erofs_fs.h
@@ -62,7 +62,7 @@ enum {
EROFS_INODE_LAYOUT_MAX
 };
 
-static bool erofs_inode_is_data_compressed(unsigned int datamode)
+static inline bool erofs_inode_is_data_compressed(unsigned int datamode)
 {
if (datamode == EROFS_INODE_FLAT_COMPRESSION)
return true;
-- 
2.17.1

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


[PATCH 2/3] staging: erofs: remove incomplete cleancache

2019-08-12 Thread Gao Xiang
cleancache was not fully implemented in EROFS.
In addition, it's tend to remove the whole cleancache in
related attempt [1].

[1] 
https://lore.kernel.org/linux-fsdevel/20190527103207.13287-3-jgr...@suse.com/
Signed-off-by: Gao Xiang 
---
 drivers/staging/erofs/data.c | 6 --
 drivers/staging/erofs/internal.h | 1 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c
index 75b859e48084..4cdb743c8b8d 100644
--- a/drivers/staging/erofs/data.c
+++ b/drivers/staging/erofs/data.c
@@ -201,12 +201,6 @@ static inline struct bio *erofs_read_raw_page(struct bio 
*bio,
goto has_updated;
}
 
-   if (cleancache_get_page(page) == 0) {
-   err = 0;
-   SetPageUptodate(page);
-   goto has_updated;
-   }
-
/* note that for readpage case, bio also equals to NULL */
if (bio &&
/* not continuous */
diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h
index 118e7c7e4d4d..4ce5991c381f 100644
--- a/drivers/staging/erofs/internal.h
+++ b/drivers/staging/erofs/internal.h
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "erofs_fs.h"
-- 
2.17.1

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


[PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON

2019-08-12 Thread Gao Xiang
Kill all the remaining BUG_ON in EROFS:
 - one BUG_ON was used to detect xattr on-disk corruption,
   proper error handling should be added for it instead;
 - the other BUG_ONs are used to detect potential issues,
   use DBG_BUGON only in (eng) debugging version.

Signed-off-by: Gao Xiang 
---
 drivers/staging/erofs/xattr.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/erofs/xattr.c b/drivers/staging/erofs/xattr.c
index b29177a17347..289c7850ec96 100644
--- a/drivers/staging/erofs/xattr.c
+++ b/drivers/staging/erofs/xattr.c
@@ -115,7 +115,7 @@ static int init_inode_xattrs(struct inode *inode)
for (i = 0; i < vi->xattr_shared_count; ++i) {
if (unlikely(it.ofs >= EROFS_BLKSIZ)) {
/* cannot be unaligned */
-   BUG_ON(it.ofs != EROFS_BLKSIZ);
+   DBG_BUGON(it.ofs != EROFS_BLKSIZ);
xattr_iter_end(&it, atomic_map);
 
it.page = erofs_get_meta_page(sb, ++it.blkaddr,
@@ -191,7 +191,7 @@ static int inline_xattr_iter_begin(struct xattr_iter *it,
 
xattr_header_sz = inlinexattr_header_size(inode);
if (unlikely(xattr_header_sz >= vi->xattr_isize)) {
-   BUG_ON(xattr_header_sz > vi->xattr_isize);
+   DBG_BUGON(xattr_header_sz > vi->xattr_isize);
return -ENOATTR;
}
 
@@ -234,7 +234,11 @@ static int xattr_foreach(struct xattr_iter *it,
if (tlimit) {
unsigned int entry_sz = EROFS_XATTR_ENTRY_SIZE(&entry);
 
-   BUG_ON(*tlimit < entry_sz);
+   /* xattr on-disk corruption: xattr entry beyond xattr_isize */
+   if (unlikely(*tlimit < entry_sz)) {
+   DBG_BUGON(1);
+   return -EIO;
+   }
*tlimit -= entry_sz;
}
 
@@ -253,7 +257,7 @@ static int xattr_foreach(struct xattr_iter *it,
 
while (processed < entry.e_name_len) {
if (it->ofs >= EROFS_BLKSIZ) {
-   BUG_ON(it->ofs > EROFS_BLKSIZ);
+   DBG_BUGON(it->ofs > EROFS_BLKSIZ);
 
err = xattr_iter_fixup(it);
if (err)
@@ -288,7 +292,7 @@ static int xattr_foreach(struct xattr_iter *it,
 
while (processed < value_sz) {
if (it->ofs >= EROFS_BLKSIZ) {
-   BUG_ON(it->ofs > EROFS_BLKSIZ);
+   DBG_BUGON(it->ofs > EROFS_BLKSIZ);
 
err = xattr_iter_fixup(it);
if (err)
-- 
2.17.1

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


Re: [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed()

2019-08-12 Thread Chao Yu
On 2019/8/13 10:30, Gao Xiang wrote:
> As a helper in erofs_fs.h, erofs_inode_is_data_compressed()
> should be inlined.
> 
> Signed-off-by: Gao Xiang 

Reviewed-by: Chao Yu 

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


Re: [PATCH 2/3] staging: erofs: remove incomplete cleancache

2019-08-12 Thread Chao Yu
On 2019/8/13 10:30, Gao Xiang wrote:
> cleancache was not fully implemented in EROFS.
> In addition, it's tend to remove the whole cleancache in
> related attempt [1].
> 
> [1] 
> https://lore.kernel.org/linux-fsdevel/20190527103207.13287-3-jgr...@suse.com/
> Signed-off-by: Gao Xiang 

Reviewed-by: Chao Yu 

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


Re: [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON

2019-08-12 Thread Chao Yu
On 2019/8/13 10:30, Gao Xiang wrote:
> Kill all the remaining BUG_ON in EROFS:
>  - one BUG_ON was used to detect xattr on-disk corruption,
>proper error handling should be added for it instead;
>  - the other BUG_ONs are used to detect potential issues,
>use DBG_BUGON only in (eng) debugging version.

BTW, do we need add WARN_ON() into DBG_BUGON() to show some details function or
call stack in where we encounter the issue?

> 
> Signed-off-by: Gao Xiang 

Reviewed-by: Chao Yu 

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


Re: [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON

2019-08-12 Thread Gao Xiang
Hi Chao,

On Tue, Aug 13, 2019 at 11:20:22AM +0800, Chao Yu wrote:
> On 2019/8/13 10:30, Gao Xiang wrote:
> > Kill all the remaining BUG_ON in EROFS:
> >  - one BUG_ON was used to detect xattr on-disk corruption,
> >proper error handling should be added for it instead;
> >  - the other BUG_ONs are used to detect potential issues,
> >use DBG_BUGON only in (eng) debugging version.
> 
> BTW, do we need add WARN_ON() into DBG_BUGON() to show some details function 
> or
> call stack in where we encounter the issue?

Thanks for kindly review :)

Agreed, it seems much better. If there are no other considerations
here, I can submit another patch addressing it later or maybe we
can change it in the next linux version since I'd like to focusing
on moving out of staging for this round...

Thanks,
Gao Xiang

> 
> > 
> > Signed-off-by: Gao Xiang 
> 
> Reviewed-by: Chao Yu 
> 
> Thanks,
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8723bs: Remove debugging information exposed via procfs

2019-08-12 Thread Kai-Heng Feng
The procfs provides many useful information for debugging, but it may be
too much for normal usage, routines like proc_get_sec_info() reports
various security related information.

So let's remove it.

Signed-off-by: Kai-Heng Feng 
---
 drivers/staging/rtl8723bs/Makefile|1 -
 drivers/staging/rtl8723bs/core/rtw_cmd.c  |5 -
 drivers/staging/rtl8723bs/core/rtw_debug.c| 1307 -
 drivers/staging/rtl8723bs/include/autoconf.h  |4 -
 drivers/staging/rtl8723bs/include/drv_types.h |2 -
 .../staging/rtl8723bs/include/osdep_intf.h|2 -
 drivers/staging/rtl8723bs/include/rtw_debug.h |   77 -
 drivers/staging/rtl8723bs/os_dep/os_intfs.c   |8 -
 drivers/staging/rtl8723bs/os_dep/rtw_proc.c   |  779 --
 drivers/staging/rtl8723bs/os_dep/rtw_proc.h   |   37 -
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c  |3 -
 11 files changed, 2225 deletions(-)
 delete mode 100644 drivers/staging/rtl8723bs/os_dep/rtw_proc.c
 delete mode 100644 drivers/staging/rtl8723bs/os_dep/rtw_proc.h

diff --git a/drivers/staging/rtl8723bs/Makefile 
b/drivers/staging/rtl8723bs/Makefile
index a12cf8dd8ed9..dfe410283ca0 100644
--- a/drivers/staging/rtl8723bs/Makefile
+++ b/drivers/staging/rtl8723bs/Makefile
@@ -60,7 +60,6 @@ r8723bs-y = \
os_dep/osdep_service.o \
os_dep/os_intfs.o \
os_dep/recv_linux.o \
-   os_dep/rtw_proc.o \
os_dep/sdio_intf.o \
os_dep/sdio_ops_linux.o \
os_dep/wifi_regd.o \
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index c6565b0e502c..8d93c2f26890 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1817,11 +1817,6 @@ static void rtw_btinfo_hdl(struct adapter *adapter, u8 
*buf, u16 buf_len)
len = info->len;
}
 
-/* define DBG_PROC_SET_BTINFO_EVT */
-#ifdef DBG_PROC_SET_BTINFO_EVT
-   btinfo_evt_dump(RTW_DBGDUMP, info);
-#endif
-
/* transform BT-FW btinfo to WiFI-FW C2H format and notify */
if (cmd_idx == BTINFO_WIFI_FETCH)
buf[1] = 0;
diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
b/drivers/staging/rtl8723bs/core/rtw_debug.c
index 695a85999270..c48a8b80af4c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
@@ -132,1310 +132,3 @@ void rf_reg_dump(void *sel, struct adapter *adapter)
}
}
 }
-
-#ifdef PROC_DEBUG
-ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, 
size_t count, loff_t *pos, void *data)
-{
-   struct net_device *dev = data;
-   struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
-   char tmp[32];
-   u32 addr, val, len;
-
-   if (count < 3) {
-   DBG_871X("argument size is less than 3\n");
-   return -EFAULT;
-   }
-
-   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
-
-   int num = sscanf(tmp, "%x %x %x", &addr, &val, &len);
-
-   if (num !=  3) {
-   DBG_871X("invalid write_reg parameter!\n");
-   return count;
-   }
-
-   switch (len) {
-   case 1:
-   rtw_write8(padapter, addr, (u8)val);
-   break;
-   case 2:
-   rtw_write16(padapter, addr, (u16)val);
-   break;
-   case 4:
-   rtw_write32(padapter, addr, val);
-   break;
-   default:
-   DBG_871X("error write length =%d", len);
-   break;
-   }
-
-   }
-
-   return count;
-
-}
-
-static u32 proc_get_read_addr = 0x;
-static u32 proc_get_read_len = 0x4;
-
-int proc_get_read_reg(struct seq_file *m, void *v)
-{
-   struct net_device *dev = m->private;
-   struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
-
-   if (proc_get_read_addr == 0x) {
-   DBG_871X_SEL_NL(m, "address not initialized\n");
-   return 0;
-   }
-
-   switch (proc_get_read_len) {
-   case 1:
-   DBG_871X_SEL_NL(m, "rtw_read8(0x%x) = 0x%x\n", 
proc_get_read_addr, rtw_read8(padapter, proc_get_read_addr));
-   break;
-   case 2:
-   DBG_871X_SEL_NL(m, "rtw_read16(0x%x) = 0x%x\n", 
proc_get_read_addr, rtw_read16(padapter, proc_get_read_addr));
-   break;
-   case 4:
-   DBG_871X_SEL_NL(m, "rtw_read32(0x%x) = 0x%x\n", 
proc_get_read_addr, rtw_read32(padapter, proc_get_read_addr));
-   break;
-   default:
-   DBG_871X_SEL_NL(m, "error read length =%d\n", 
proc_get_read_len);
-   break;
-   }
-
-   return 0;
-}
-
-ssize_t proc_set_read_reg(struct file *file, const char __user 

Re: [PATCH 01/11] staging: rtl8712: _r8712_init_xmit_priv(): Change return values and type

2019-08-12 Thread Nishka Dasgupta

On 12/08/19 8:07 PM, Greg KH wrote:

On Fri, Aug 09, 2019 at 10:53:43AM +0530, Nishka Dasgupta wrote:

Change the return values in _r8712_init_xmit_priv from _SUCCESS/_FAIL to
0/-ENOMEM respectively. Change return type from sint to int.

Signed-off-by: Nishka Dasgupta 


I only received 9 patches in this series.  I'll try to apply these, but
if they fail, please fix up your tree, and resend the remaining ones.


Okay. I'm resending the 4 patches that haven't been applied yet.

Thanking you,
Nishka



thanks,

greg k-h



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


[PATCH RESEND 2/4] staging: rtl8712: r8712_append_mpdu_unit(): Change return type

2019-08-12 Thread Nishka Dasgupta
Change return type of r8712_append_mpdu_unit from u8 to void and remove
its return statement as it always returns only _SUCCESS. Modify call
sites to simply call this function instead of checking its return value,
and execute all the statements in the if-block for when the function
returns _SUCCESS.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/rtl8712_xmit.c | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
b/drivers/staging/rtl8712/rtl8712_xmit.c
index 04e70048f0dd..6f1dbcf25859 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -278,8 +278,8 @@ void r8712_construct_txaggr_cmd_hdr(struct xmit_buf 
*pxmitbuf)
pcmdpriv->cmd_seq++;
 }
 
-u8 r8712_append_mpdu_unit(struct xmit_buf *pxmitbuf,
-   struct xmit_frame *pxmitframe)
+void r8712_append_mpdu_unit(struct xmit_buf *pxmitbuf,
+   struct xmit_frame *pxmitframe)
 {
struct _adapter *padapter = pxmitframe->padapter;
struct tx_desc *ptx_desc = (struct tx_desc *)pxmitbuf->pbuf;
@@ -315,8 +315,6 @@ u8 r8712_append_mpdu_unit(struct xmit_buf *pxmitbuf,
((ptx_desc->txdw0 & 0x) +
((TXDESC_SIZE + last_txcmdsz + padding_sz) &
 0x)));
-
-   return _SUCCESS;
 }
 
 
@@ -332,8 +330,8 @@ u8 r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
/*RTL8712_DMA_H2CCMD */
r8712_construct_txaggr_cmd_desc(pxmitbuf);
r8712_construct_txaggr_cmd_hdr(pxmitbuf);
-   if (r8712_append_mpdu_unit(pxmitbuf, pxmitframe) == _SUCCESS)
-   pxmitbuf->aggr_nr = 1;
+   r8712_append_mpdu_unit(pxmitbuf, pxmitframe);
+   pxmitbuf->aggr_nr = 1;
 
return _SUCCESS;
 }
@@ -347,11 +345,10 @@ u16 r8712_xmitframe_aggr_next(struct xmit_buf *pxmitbuf,
/* buffer addr assoc */
pxmitframe->buf_addr = pxmitbuf->pbuf + TXDESC_SIZE +
(((struct tx_desc *)pxmitbuf->pbuf)->txdw0 & 0x);
-   if (r8712_append_mpdu_unit(pxmitbuf, pxmitframe) == _SUCCESS) {
-   r8712_free_xmitframe_ex(&pxmitframe->padapter->xmitpriv,
-   pxmitframe);
-   pxmitbuf->aggr_nr++;
-   }
+   r8712_append_mpdu_unit(pxmitbuf, pxmitframe);
+   r8712_free_xmitframe_ex(&pxmitframe->padapter->xmitpriv,
+   pxmitframe);
+   pxmitbuf->aggr_nr++;
 
return TXDESC_SIZE +
(((struct tx_desc *)pxmitbuf->pbuf)->txdw0 & 0x);
-- 
2.19.1

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


[PATCH RESEND 4/4] staging: rtl8712: r8712_dump_aggr_xframe(): Change type to void

2019-08-12 Thread Nishka Dasgupta
Change return type of r8712_dump_aggr_xframe from u8 to void as it
always returns _SUCCESS and its return value is never used.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/rtl8712_xmit.c | 6 ++
 drivers/staging/rtl8712/rtl8712_xmit.h | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
b/drivers/staging/rtl8712/rtl8712_xmit.c
index 9152c25c11f8..c247f92207f5 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -352,8 +352,8 @@ u16 r8712_xmitframe_aggr_next(struct xmit_buf *pxmitbuf,
(((struct tx_desc *)pxmitbuf->pbuf)->txdw0 & 0x);
 }
 
-u8 r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
-   struct xmit_frame *pxmitframe)
+void r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
+   struct xmit_frame *pxmitframe)
 {
struct _adapter *padapter = pxmitframe->padapter;
struct dvobj_priv *pdvobj = &padapter->dvobjpriv;
@@ -390,8 +390,6 @@ u8 r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
}
r8712_write_port(pxmitframe->padapter, RTL8712_DMA_H2CCMD,
total_length + TXDESC_SIZE, (u8 *)pxmitframe);
-
-   return _SUCCESS;
 }
 
 #endif
diff --git a/drivers/staging/rtl8712/rtl8712_xmit.h 
b/drivers/staging/rtl8712/rtl8712_xmit.h
index faf2128285b6..0b56bd3ac4d0 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.h
+++ b/drivers/staging/rtl8712/rtl8712_xmit.h
@@ -104,8 +104,8 @@ void r8712_do_queue_select(struct _adapter *padapter,
 #ifdef CONFIG_R8712_TX_AGGR
 void r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
  struct xmit_frame *pxmitframe);
-u8 r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
-   struct xmit_frame *pxmitframe);
+void r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
+   struct xmit_frame *pxmitframe);
 #endif
 
 #endif
-- 
2.19.1

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


[PATCH RESEND 3/4] staging: rtl8712: r8712_xmitframe_aggr_1st(): Change return type to void

2019-08-12 Thread Nishka Dasgupta
Change return type of r8712_xmitframe_aggr_1st from u8 to void as it
always returns _SUCCESS and its return value is never used.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/rtl8712_xmit.c | 6 ++
 drivers/staging/rtl8712/rtl8712_xmit.h | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
b/drivers/staging/rtl8712/rtl8712_xmit.c
index 6f1dbcf25859..9152c25c11f8 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -318,8 +318,8 @@ void r8712_append_mpdu_unit(struct xmit_buf *pxmitbuf,
 }
 
 
-u8 r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
-   struct xmit_frame *pxmitframe)
+void r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
+ struct xmit_frame *pxmitframe)
 {
/* linux complete context doesn't need to protect */
pxmitframe->pxmitbuf = pxmitbuf;
@@ -332,8 +332,6 @@ u8 r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
r8712_construct_txaggr_cmd_hdr(pxmitbuf);
r8712_append_mpdu_unit(pxmitbuf, pxmitframe);
pxmitbuf->aggr_nr = 1;
-
-   return _SUCCESS;
 }
 
 u16 r8712_xmitframe_aggr_next(struct xmit_buf *pxmitbuf,
diff --git a/drivers/staging/rtl8712/rtl8712_xmit.h 
b/drivers/staging/rtl8712/rtl8712_xmit.h
index 9be8fb70c92e..faf2128285b6 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.h
+++ b/drivers/staging/rtl8712/rtl8712_xmit.h
@@ -102,8 +102,8 @@ void r8712_do_queue_select(struct _adapter *padapter,
   struct pkt_attrib *pattrib);
 
 #ifdef CONFIG_R8712_TX_AGGR
-u8 r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
-   struct xmit_frame *pxmitframe);
+void r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf,
+ struct xmit_frame *pxmitframe);
 u8 r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
struct xmit_frame *pxmitframe);
 #endif
-- 
2.19.1

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


[PATCH RESEND 1/4] staging: rtl8712: xmitframe_addmic(): Change return values and type

2019-08-12 Thread Nishka Dasgupta
Change return values of xmitframe_addmic from _SUCCESS and _FAIL to 0
and -ENOMEM respectively. Modify call sites to check for non-zero values
instead of _FAIL.
Also change return type from sint to int.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/rtl871x_xmit.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c 
b/drivers/staging/rtl8712/rtl871x_xmit.c
index 178f8b96943b..cc5809e49e35 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -342,8 +342,8 @@ int r8712_update_attrib(struct _adapter *padapter, _pkt 
*pkt,
return 0;
 }
 
-static sint xmitframe_addmic(struct _adapter *padapter,
-struct xmit_frame *pxmitframe)
+static int xmitframe_addmic(struct _adapter *padapter,
+   struct xmit_frame *pxmitframe)
 {
u32 curfragnum, length;
u8  *pframe, *payload, mic[8];
@@ -372,7 +372,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
if (!memcmp(psecuritypriv->XGrptxmickey
   [psecuritypriv->XGrpKeyid].skey,
   null_key, 16))
-   return _FAIL;
+   return -ENOMEM;
/*start to calculate the mic code*/
r8712_secmicsetkey(&micdata,
 psecuritypriv->
@@ -381,7 +381,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
} else {
if (!memcmp(&stainfo->tkiptxmickey.skey[0],
null_key, 16))
-   return _FAIL;
+   return -ENOMEM;
/* start to calculate the mic code */
r8712_secmicsetkey(&micdata,
 &stainfo->tkiptxmickey.skey[0]);
@@ -442,7 +442,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
payload = payload - pattrib->last_txcmdsz + 8;
}
}
-   return _SUCCESS;
+   return 0;
 }
 
 static sint xmitframe_swencrypt(struct _adapter *padapter,
@@ -696,7 +696,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, 
_pkt *pkt,
memcpy(mem_start, pbuf_start + TXDESC_OFFSET, pattrib->hdrlen);
}
 
-   if (xmitframe_addmic(padapter, pxmitframe) == _FAIL)
+   if (xmitframe_addmic(padapter, pxmitframe))
return _FAIL;
xmitframe_swencrypt(padapter, pxmitframe);
return _SUCCESS;
-- 
2.19.1

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


Re: [PATCH v2 15/34] staging/vc04_services: convert put_page() to put_user_page*()

2019-08-12 Thread Stefan Wahren
On 05.08.19 00:48, john.hubb...@gmail.com wrote:
> From: John Hubbard 
>
> For pages that were retained via get_user_pages*(), release those pages
> via the new put_user_page*() routines, instead of via put_page() or
> release_pages().
>
> This is part a tree-wide conversion, as described in commit fc1d8e7cca2d
> ("mm: introduce put_user_page*(), placeholder versions").
>
> Acked-by: Greg Kroah-Hartman 
>
> Cc: Eric Anholt 
> Cc: Stefan Wahren 
> Cc: Greg Kroah-Hartman 
> Cc: Mihaela Muraru 
> Cc: Suniel Mahesh 
> Cc: Al Viro 
> Cc: Sidong Yang 
> Cc: Kishore KP 
> Cc: linux-rpi-ker...@lists.infradead.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: de...@driverdev.osuosl.org
> Signed-off-by: John Hubbard 
Acked-by: Stefan Wahren 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON

2019-08-12 Thread Chao Yu
Hi Xiang,

On 2019/8/13 11:57, Gao Xiang wrote:
> Hi Chao,
> 
> On Tue, Aug 13, 2019 at 11:20:22AM +0800, Chao Yu wrote:
>> On 2019/8/13 10:30, Gao Xiang wrote:
>>> Kill all the remaining BUG_ON in EROFS:
>>>  - one BUG_ON was used to detect xattr on-disk corruption,
>>>proper error handling should be added for it instead;
>>>  - the other BUG_ONs are used to detect potential issues,
>>>use DBG_BUGON only in (eng) debugging version.
>>
>> BTW, do we need add WARN_ON() into DBG_BUGON() to show some details function 
>> or
>> call stack in where we encounter the issue?
> 
> Thanks for kindly review :)
> 
> Agreed, it seems much better. If there are no other considerations
> here, I can submit another patch addressing it later or maybe we
> can change it in the next linux version since I'd like to focusing
> on moving out of staging for this round...

No problem, we can change it in a proper time.

Thanks,

> 
> Thanks,
> Gao Xiang
> 
>>
>>>
>>> Signed-off-by: Gao Xiang 
>>
>> Reviewed-by: Chao Yu 
>>
>> Thanks,
> .
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [bug report] staging: wilc1000: added support to dynamically add/remove interfaces

2019-08-12 Thread Ajay.Kathat
Hi Dan,

On 8/8/2019 4:18 PM, Dan Carpenter wrote:
> 
> Hello Ajay Singh,
> 
> The patch 9bc061e88054: "staging: wilc1000: added support to
> dynamically add/remove interfaces" from Jun 26, 2019, leads to the
> following static checker warning:
> 
>   drivers/staging/wilc1000/wilc_wlan.c:497 wilc_wlan_handle_txq()
>   warn: missing error code here? 'wilc_wlan_txq_get_first()' failed.
> 
> drivers/staging/wilc1000/wilc_wlan.c
>474  int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
>475  {
>476  int i, entries = 0;
>477  u32 sum;
>478  u32 reg;
>479  u32 offset = 0;
>480  int vmm_sz = 0;
>481  struct txq_entry_t *tqe;
>482  int ret = 0;
> ^^^
> 
>483  int counter;
>484  int timeout;
>485  u32 vmm_table[WILC_VMM_TBL_SIZE];
>486  const struct wilc_hif_func *func;
>487  u8 *txb = wilc->tx_buffer;
>488  struct net_device *dev;
>489  struct wilc_vif *vif;
>490  
>491  if (wilc->quit)
>492  goto out;
>493  
>494  mutex_lock(&wilc->txq_add_to_head_cs);
>495  tqe = wilc_wlan_txq_get_first(wilc);
>496  if (!tqe)
>497  goto out;
> 
> Should this really be a success path?

I think, returning value '0' is safe here. Only 'ENOBUFS' return value
is used for retry while other values are not considered. The 'if'
condition exit this function in case the list is empty. And later the
elements will be fetched again once'txq_event' completion signal is
received.

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


[PATCH] Staging: rtl8712: rtl8712_recv: fixed 80 character length warning

2019-08-12 Thread Merwin Trever Ferrao
When the checkpatch.pl script was run, it showed lines with length
more than 80 characters in rtl8712_recv.c file. Fixed by
breaking it up into two lines within 80 characters.

Signed-off-by: Merwin Trever Ferrao 
---
 drivers/staging/rtl8712/rtl8712_recv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c 
b/drivers/staging/rtl8712/rtl8712_recv.c
index 42cb2c95b40c..9901815604f4 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -35,7 +35,8 @@ static u8 rfc1042_header[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 
0x00};
 
 static void recv_tasklet(void *priv);
 
-void r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter 
*padapter)
+void r8712_init_recv_priv(struct recv_priv *precvpriv,
+ struct _adapter *padapter)
 {
int i;
struct recv_buf *precvbuf;
-- 
2.17.1

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