Re: [PATCH v5 0/5] usb: typec: ucsi: ccg: add runtime pm support

2019-06-07 Thread Wolfram Sang
On Fri, Jun 07, 2019 at 09:34:18AM -0700, Ajay Gupta wrote:
> Hi Heikki and Wolfram
> The latest set (v5) fix comments from Wolfram on further refactoring
> master_xfer() function in i2c-nvidia-gpuc.c file and removing extra comments
> in patch 2/5.
> 
> Patches can go through either usb or i2c tree but since there are 3 out of 5
> patches from i2c so may be better they go through i2c. They all should go
> together.
> 
> Thanks
> Ajay

Applied the series to i2c/for-next, thanks!



signature.asc
Description: PGP signature


Re: [PATCH v4 1/5] i2c: nvidia-gpu: refactor master_xfer

2019-06-07 Thread Wolfram Sang
> Changes from v3->v4:
>   - Further refactor master_xfer based on Wolfram's comment.

Yay, looks even better. One thing to improve, though.

>   status = gpu_i2c_stop(i2cd);

send_stop = false;

> - if (status < 0)
> - return status;
> + if (status < 0) {
> + send_stop = false;

and skip it here...

> + goto exit;
> + }
>  
> - return i;
> -stop:
> - status2 = gpu_i2c_stop(i2cd);
> - if (status2 < 0)
> - dev_err(i2cd->dev, "i2c stop failed %d\n", status2);
> + send_stop = false;

... and here.



signature.asc
Description: PGP signature


Re: [PATCH v4 2/5] i2c: nvidia-gpu: add runtime pm support

2019-06-07 Thread Wolfram Sang

> + pm_runtime_mark_last_busy(i2cd->dev);
> + pm_runtime_put_autosuspend(i2cd->dev);

Much better to have this only once!

> +/*
> + * We need gpu_i2c_suspend() even if it is stub, for runtime pm to work
> + * correctly. Without it, lspci shows runtime pm status as "D0" for the card.
> + * Documentation/power/pci.txt also insists for driver to provide this:

I'd think the comment up to here is enough and the rest can go. However,
I leave this decision to you.



signature.asc
Description: PGP signature


Re: [PATCH v4 3/5] usb: typec: ucsi: ccg: enable runtime pm support

2019-06-07 Thread Wolfram Sang
On Fri, Jun 07, 2019 at 11:25:10AM +0300, Heikki Krogerus wrote:
> On Mon, Jun 03, 2019 at 10:05:43AM -0700, Ajay Gupta wrote:
> > From: Ajay Gupta 
> > 
> > The change enables runtime pm support to UCSI CCG driver.
> > Added ucsi_resume() function to enable notification after
> > system reusme. Exported both ucsi_resume() and ucsi_send_command()
> > symbols in ucsi.c for modular build.
> > 
> > Signed-off-by: Ajay Gupta 
> 
> Was the idea that Wolfram picks these? In that case:

Cover letter says your tree, will check the i2c patches now.



signature.asc
Description: PGP signature


Re: [PATCH v3 4/5] i2c: nvidia-gpu: resume ccgx i2c client

2019-05-25 Thread Wolfram Sang
On Wed, May 22, 2019 at 11:31:41AM -0700, Ajay Gupta wrote:
> From: Ajay Gupta 
> 
> Cypress USB Type-C CCGx controller firmware version 3.1.10
> (which is being used in many NVIDIA GPU cards) has known issue of
> not triggering interrupt when a USB device is hot plugged to runtime
> resume the controller. If any GPU card gets latest kernel with runtime
> pm support but does not get latest fixed firmware then also it should
> continue to work and therefore a workaround is required to check for
> any connector change event
> 
> The workaround is to request runtime resume of i2c client
> which is UCSI Cypress CCGx driver. CCG driver will call the ISR
> for any connector change event only if NVIDIA GPU has old
> CCG firmware with the known issue.
> 
> Signed-off-by: Ajay Gupta 

Can't say if this is a valid workaround but here is my ack for modifying
the I2C realm:

Acked-by: Wolfram Sang 



signature.asc
Description: PGP signature


Re: [PATCH v3 2/5] i2c: nvidia-gpu: add runtime pm support

2019-05-25 Thread Wolfram Sang

> @@ -211,6 +212,8 @@ static int gpu_i2c_master_xfer(struct i2c_adapter *adap,
>   goto exit;
>   }
>  
> + pm_runtime_mark_last_busy(i2cd->dev);
> + pm_runtime_put_autosuspend(i2cd->dev);
>   return i;
>  exit:
>   if (send_stop) {
> @@ -218,6 +221,8 @@ static int gpu_i2c_master_xfer(struct i2c_adapter *adap,
>   if (status2 < 0)
>   dev_err(i2cd->dev, "i2c stop failed %d\n", status2);
>   }
> + pm_runtime_mark_last_busy(i2cd->dev);
> + pm_runtime_put_autosuspend(i2cd->dev);

Maybe another worthwhile refactorization possible here? The exit code
path and 'all good' code path look very similar. This can be done
incrementally, though. I think for now it is okay.

> +static __maybe_unused int gpu_i2c_suspend(struct device *dev)
> +{
> + return 0;
> +}

Why do we need this?



signature.asc
Description: PGP signature


Re: [PATCH v3 1/5] i2c: nvidia-gpu: refactor master_xfer

2019-05-25 Thread Wolfram Sang
On Wed, May 22, 2019 at 11:31:38AM -0700, Ajay Gupta wrote:
> From: Ajay Gupta 
> 
> Added a local variable "send_stop" to simplify "goto" statements.
> 
> The "send_stop" handles below two case
> 1) When first i2c start fails and so i2c stop is not sent before
> exiting
> 
> 2) When i2c stop failed after all transfers and we do not need to
> send another stop before exiting.
> 
> Signed-off-by: Ajay Gupta 

Nice! It was only a brainstorming suggestion to use a dedicated flag.
But I must say I like the outcome; much better readable code IMO.

Suggested-by: Wolfram Sang 
Reviewed-by: Wolfram Sang 



signature.asc
Description: PGP signature


Re: [PATCH 1/4] i2c: nvidia-gpu: add runtime pm support

2019-05-20 Thread Wolfram Sang

> > I am not nacking this, yet the use of goto here seems too much for my 
> > taste. If
> > you could try refactoring the whole code (dunno, maybe using a flag when to
> > use stop?), I'd appreciate this.
> Ok, I will add a local variable to make it more readable.

I was brainstorming here, I am not sure if it will work or not. But you
will see. Maybe you get other ideas on the way. However, thanks for
trying out!



signature.asc
Description: PGP signature


Re: [PATCH 3/4] i2c: nvidia-gpu: resume ccgx i2c client

2019-05-19 Thread Wolfram Sang

> + /* runtime resume ccgx client so that it can see for any
> +  * connector change event. Old ccg firmware has known
> +  * issue of not triggering interrupt when a device is
> +  * connected to runtime resume the controller.
> +  */

Check coding style for comments.

BTW how do you suggest this gets upstream? Through the usb-tree? Would
be fine with me. Are there any dependencies? The cover-letter doesn't
mention it.



signature.asc
Description: PGP signature


Re: [PATCH 1/4] i2c: nvidia-gpu: add runtime pm support

2019-05-19 Thread Wolfram Sang
> diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c 
> b/drivers/i2c/busses/i2c-nvidia-gpu.c
> index 1c8f708f212b..9d347583f8dc 100644
> --- a/drivers/i2c/busses/i2c-nvidia-gpu.c
> +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
> @@ -175,6 +175,7 @@ static int gpu_i2c_master_xfer(struct i2c_adapter *adap,
>* The controller supports maximum 4 byte read due to known
>* limitation of sending STOP after every read.
>*/
> + pm_runtime_get_sync(i2cd->dev);
>   for (i = 0; i < num; i++) {
>   if (msgs[i].flags & I2C_M_RD) {
>   /* program client address before starting read */
> @@ -189,7 +190,7 @@ static int gpu_i2c_master_xfer(struct i2c_adapter *adap,
>   status = gpu_i2c_start(i2cd);
>   if (status < 0) {
>   if (i == 0)
> - return status;
> + goto exit;
>   goto stop;

Hmm, goto here, goto there... OK, the code didn't have a good flow even
before this patch.

>   }
>  
> @@ -206,13 +207,18 @@ static int gpu_i2c_master_xfer(struct i2c_adapter *adap,
>   }
>   status = gpu_i2c_stop(i2cd);
>   if (status < 0)
> - return status;
> + goto exit;
>  
> + pm_runtime_mark_last_busy(i2cd->dev);
> + pm_runtime_put_autosuspend(i2cd->dev);
>   return i;
>  stop:
>   status2 = gpu_i2c_stop(i2cd);
>   if (status2 < 0)
>   dev_err(i2cd->dev, "i2c stop failed %d\n", status2);
> +exit:
> + pm_runtime_mark_last_busy(i2cd->dev);
> + pm_runtime_put_autosuspend(i2cd->dev);
>   return status;
>  }

I am not nacking this, yet the use of goto here seems too much for my
taste. If you could try refactoring the whole code (dunno, maybe using a
flag when to use stop?), I'd appreciate this.



signature.asc
Description: PGP signature


Re: [PATCH v15 1/2] i2c: buses: add i2c bus driver for NVIDIA GPU

2018-11-09 Thread Wolfram Sang

> > I can't send an incremental patch for this, I need to ask: did you try
> > SMBUS_QUICK with it?
> Tried it today using i2cdetect and it looks good to me.

Yup, looks good. Thanks for checking!



signature.asc
Description: PGP signature


Re: [PATCH v15 2/2] usb: typec: ucsi: add support for Cypress CCGx

2018-11-09 Thread Wolfram Sang
On Fri, Oct 26, 2018 at 09:36:59AM -0700, Ajay Gupta wrote:
> Latest NVIDIA GPU cards have a Cypress CCGx Type-C controller
> over I2C interface.
> 
> This UCSI I2C driver uses I2C bus driver interface for communicating
> with Type-C controller.
> 
> Signed-off-by: Ajay Gupta 

Applied to for-current, thanks!



signature.asc
Description: PGP signature


Re: [PATCH v15 1/2] i2c: buses: add i2c bus driver for NVIDIA GPU

2018-11-09 Thread Wolfram Sang

> It will be good if both of them can go together either through I2C or 
> USB subsystem. Since USB part is reviewed and has Acked-by Heikki so please
> take that also.

Hmmm, technicallly, there is no need to let them go together. There is
no strict dependency. Yet, since Heikki gave his ack, I assume he wants
it to go via I2C, too. I will make an exception this time and take it.



signature.asc
Description: PGP signature


Re: [PATCH v15 0/2] Add support for USB Type-C interface on latest NVIDIA GPU

2018-11-09 Thread Wolfram Sang

> Hmm... It would be a bit difficult (requires to download patches again as 
> mbox).
> I would rather give you a hint how I resolve such problem when apply a tag to 
> a
> pile of patches.

I don't mean now, for future patch series, that is... With this one, all
is fine...

> git filter-branch --msg-filter \
>   'sed -e "/Signed-off-by:/ a Reviewed-by: Andy Shevchenko 
> "' \
>   -f HEAD~2..HEAD

Yes, I have something in place like this, no problem. The issue is that
patches which have a review indicated (by patchwork's patch list) get a
priority boost when I process patches.

Maybe patchwork will learn someday to handle tags given to
coverletters... I am probably not the first one to stumble over this.



signature.asc
Description: PGP signature


Re: [PATCH v15 1/2] i2c: buses: add i2c bus driver for NVIDIA GPU

2018-11-09 Thread Wolfram Sang

> @@ -140,5 +140,6 @@ obj-$(CONFIG_I2C_SIBYTE)  += i2c-sibyte.o
>  obj-$(CONFIG_I2C_XGENE_SLIMPRO) += i2c-xgene-slimpro.o
>  obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
>  obj-$(CONFIG_I2C_FSI)+= i2c-fsi.o
> +obj-$(CONFIG_I2C_NVIDIA_GPU) += i2c-nvidia-gpu.o

Oh, I fixed this up and moved it to the place where it is corresponding
to in Kconfig.

> +static u32 gpu_i2c_functionality(struct i2c_adapter *adap)
> +{
> + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
> +}

I can't send an incremental patch for this, I need to ask: did you try
SMBUS_QUICK with it? Given the restrictions of this controller, I have
my doubts. I might be wrong, though. 'i2cdetect' from i2c-tools lets you
easily check it.



signature.asc
Description: PGP signature


Re: [PATCH v15 0/2] Add support for USB Type-C interface on latest NVIDIA GPU

2018-11-09 Thread Wolfram Sang
On Mon, Oct 29, 2018 at 02:42:37PM +0200, Andy Shevchenko wrote:
> On Fri, Oct 26, 2018 at 09:36:57AM -0700, Ajay Gupta wrote:
> > Hi Heikki and Wolfram,
> > 
> > These two changes add support for USB Type-C interface on latest NVIDIA GPU 
> > card.
> > The Type-C controller used is Cypress CCGx and is over I2C interface.
> > 
> > I2C host controller has known limitation of sending STOP after every read. 
> > Since
> > each read can be of 4 byte maximum length so there is a limit of 4 byte 
> > read.
> > This is mentioned in adapter quirks as "max_read_len = 4"
> > 
> > I2C host controller is mainly used for "write-then-read" or "write" 
> > messages so added
> > the flag I2C_AQ_COMB_WRITE_THEN_READ in adapter quirks.
> > 
> > PATCH[2/2] on ucsi driver now have added logic to check i2c adapter quirks 
> > and
> > issues i2c read transfer based on max_read_len quirk settings. This will 
> > make sure
> > the read limitation is not affecting I2C host which do not have such 
> > limitation.
> > 
> > I think the patches should through usb tree because the main functionality 
> > is
> > usb Type-C.
> 
> FWIW,
> Reviewed-by: Andy Shevchenko 

Thanks, Andy. Your review is worth something :)

May I ask you to add your tag to the individual patches (as long as it
is not a patch bomb), so patchwork will pick them up and I see them
immediately?



signature.asc
Description: PGP signature


Re: [PATCH v15 1/2] i2c: buses: add i2c bus driver for NVIDIA GPU

2018-11-09 Thread Wolfram Sang
On Fri, Oct 26, 2018 at 09:36:58AM -0700, Ajay Gupta wrote:
> Latest NVIDIA GPU card has USB Type-C interface. There is a
> Type-C controller which can be accessed over I2C.
> 
> This driver adds I2C bus driver to communicate with Type-C controller.
> I2C client driver will be part of USB Type-C UCSI driver.
> 
> Signed-off-by: Ajay Gupta 

I have some minor comments, yet the driver is good enough to be applied,
I think. Thanks to all involved in reviewing this! I'll use the rc1 rule
for new drivers and send my comments as incremental patches. So:

Applied to for-current, thanks!

I will leave the USB part of this series for the USB subsystem. If I
shall take it through I2C, please let me know.



signature.asc
Description: PGP signature


Re: [PATCH 1/3] i2c: sh_mobile: Remove dummy runtime PM callbacks

2018-10-28 Thread Wolfram Sang
On Wed, Oct 24, 2018 at 04:51:32PM +0300, Jarkko Nikula wrote:
> Platform drivers don't need dummy runtime PM callbacks that just return
> success and non-NULL pm pointer in their struct device_driver in order
> to have runtime PM happening. This has changed since following commits:
> 
> 05aa55dddb9e ("PM / Runtime: Lenient generic runtime pm callbacks")
> 543f2503a956 ("PM / platform_bus: Allow runtime PM by default")
> 8b313a38ecff ("PM / Platform: Use generic runtime PM callbacks directly")
> 
> Signed-off-by: Jarkko Nikula 

Applied to for-next, thanks!



signature.asc
Description: PGP signature


Re: [PATCH 3/3] usb: renesas_usbhs: Remove dummy runtime PM callbacks

2018-10-25 Thread Wolfram Sang
On Wed, Oct 24, 2018 at 04:51:34PM +0300, Jarkko Nikula wrote:
> Platform drivers don't need dummy runtime PM callbacks that just return
> success in order to have runtime PM happening. This has changed since
> following commits:
> 
> 05aa55dddb9e ("PM / Runtime: Lenient generic runtime pm callbacks")
> 543f2503a956 ("PM / platform_bus: Allow runtime PM by default")
> 8b313a38ecff ("PM / Platform: Use generic runtime PM callbacks directly")
> 
> Signed-off-by: Jarkko Nikula 

Acked-by: Wolfram Sang 

>  static const struct dev_pm_ops usbhsc_pm_ops = {
>   .suspend= usbhsc_suspend,
>   .resume = usbhsc_resume,

Unrelated to this patch, but I wonder right now: is there a reason not
to use SET_SYSTEM_SLEEP_PM_OPS here? Shimoda-san?



signature.asc
Description: PGP signature


Re: [PATCH 2/3] net: ethernet: Remove dummy runtime PM callbacks from Renesas drivers

2018-10-25 Thread Wolfram Sang
On Wed, Oct 24, 2018 at 04:51:33PM +0300, Jarkko Nikula wrote:
> Platform drivers don't need dummy runtime PM callbacks that just return
> success in order to have runtime PM happening. This has changed since
> following commits:
> 
> 05aa55dddb9e ("PM / Runtime: Lenient generic runtime pm callbacks")
> 543f2503a956 ("PM / platform_bus: Allow runtime PM by default")
> 8b313a38ecff ("PM / Platform: Use generic runtime PM callbacks directly")
> 
> Signed-off-by: Jarkko Nikula 

Acked-by: Wolfram Sang 



signature.asc
Description: PGP signature


Re: [PATCH 0/3] PM: Renesas: Remove dummy runtime PM callbacks

2018-10-24 Thread Wolfram Sang

> At least the I2C driver part of this was on my todo list as well (just a
> bit lower :/). I wanted to find out why they have been there in the
> first place. Do you know if such callbacks were needed "back in the
> days"?

I see now that you referenced the relevant commits in the patch
descriptions. Thanks!



signature.asc
Description: PGP signature


Re: [PATCH 0/3] PM: Renesas: Remove dummy runtime PM callbacks

2018-10-24 Thread Wolfram Sang
On Wed, Oct 24, 2018 at 04:51:31PM +0300, Jarkko Nikula wrote:
> I noticed these independent Renesas drivers have needless dummy runtime
> PM callbacks. I don't have the HW so only build tested.
> 
> Patches can be applied independently to their own subsystems. I wanted to
> send them together if some of them gets Tested-by or sees a regression.

At least the I2C driver part of this was on my todo list as well (just a
bit lower :/). I wanted to find out why they have been there in the
first place. Do you know if such callbacks were needed "back in the
days"?

Adding Magnus to recipients...

> 
> Jarkko Nikula (3):
>   i2c: sh_mobile: Remove dummy runtime PM callbacks
>   net: ethernet: Remove dummy runtime PM callbacks from Renesas drivers
>   usb: renesas_usbhs: Remove dummy runtime PM callbacks
> 
>  drivers/i2c/busses/i2c-sh_mobile.c   | 18 --
>  drivers/net/ethernet/renesas/ravb_main.c | 13 -
>  drivers/net/ethernet/renesas/sh_eth.c| 13 -
>  drivers/usb/renesas_usbhs/common.c   | 14 --
>  4 files changed, 58 deletions(-)
> 
> -- 
> 2.19.1
> 


signature.asc
Description: PGP signature


Re: [PATCH v12 1/2] i2c: buses: add i2c bus driver for NVIDIA GPU

2018-10-16 Thread Wolfram Sang

> I don't think SMBus is an option in this case since the intended client 
> (Cypress
> something in patch 2/2) does xfers that would need 16-bit commands and I think
> they are always 8-bit in SMBus, no?

Yes. Command is 8 bit, data can be 16. Thanks for the heads up!



signature.asc
Description: PGP signature


Re: [PATCH v12 1/2] i2c: buses: add i2c bus driver for NVIDIA GPU

2018-10-02 Thread Wolfram Sang
Hi,

> > > We got confirmation from HW team about 4 byte read limitation. There
> > > has to be a STOP after every single read cycle. One read cycle
> > > supports maximum of
> > > 4 byte burst. I will update the patches with a comment on this.
> > 
> > Could it be that this is more an SMBus controller than an I2C controller?
> > I haven't looked at the specs but maybe populating smbus_xfer instead of
> > master_xfer is an option here?
> I think its more of i2c controller and we do mention " .max_read_len = 4" in
> " struct i2c_adapter_quirks". Do you still see something missing here?

Well, if there has to be STOP after a read, then you can't do a transfer
containing "write-read-write", or? So, I wondered if this controller is
of the type which can mainly do "write-then-read" transfers only (check
I2C_AQ_COMB* quirk flags). And for some of those controller types, it
might be even easier to drop generic I2C transfers and only handle the
SMBUS calls.

I didn't check this driver closely yet, so I can't tell if/what it needs
from the above. I wanted to give this input already, though.

Regards,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCH v12 1/2] i2c: buses: add i2c bus driver for NVIDIA GPU

2018-10-01 Thread Wolfram Sang
On Mon, Oct 01, 2018 at 07:33:02PM +, Ajay Gupta wrote:
> Hi Heikki and Peter,
> 
> > > > > Can we get the working set in while the issues is being debugged?
> > > >
> > > > I'm not the one making the decision, and I don't even know if this
> > > > is going through the i2c or the usb tree? If it's going through the
> > > > i2c tree you need a tag from the usb people (Greg?) on patch 2/2,
> > > > and if it's going through the usb tree, you need a tag from Wolfram
> > > > on patch 1/2. As I said, I'm not involved with that part, I'm just
> > > > reviewing these patches because I felt like it.
> > > >
> > > > The remaining issue that bothers me is the looping reads, and your
> > > > email address reveals that you should be in a very good position to
> > > > work out why they do not work, and fix it or let us know why they
> > > > don't.
> > I am working with different teams to debug this and I think it may take some
> > time to know the root cause.
> We got confirmation from HW team about 4 byte read limitation. There has to
> be a STOP after every single read cycle. One read cycle supports maximum of
> 4 byte burst. I will update the patches with a comment on this.

Could it be that this is more an SMBus controller than an I2C
controller? I haven't looked at the specs but maybe populating
smbus_xfer instead of master_xfer is an option here?



signature.asc
Description: PGP signature


Re: [PATCH v5 2/2] usb: typec: ucsi: add support for Cypress CCGx

2018-09-05 Thread Wolfram Sang
On Wed, Sep 05, 2018 at 10:17:26PM +, Ajay Gupta wrote:
> Hi Greg,
> 
> > > +static int ccg_read(struct ucsi_ccg *uc, u16 rab, u8 *data, u32 len)
> > > +{
> > > + struct device *dev = uc->dev;
> > > + struct i2c_client *client = uc->client;
> > > + unsigned char buf[2];
> > > + struct i2c_msg msgs[] = {
> > > + {
> > > + .addr   = client->addr,
> > > + .flags  = 0x0,
> > > + .len= 0x2,
> > > + .buf= buf,
> > > + },
> > > + {
> > > + .addr   = client->addr,
> > > + .flags  = I2C_M_RD,
> > > + .buf= data,
> > > + },
> > > + };
> > 
> > Are you sure you are allowed to do i2c messages off of the stack like this?
> > Will that work on all platforms?

DMA is optional with I2C. These messages do not set the I2C_M_DMASAFE
flag, so it should be OK.



signature.asc
Description: PGP signature


Re: [PATCH v3 1/2] i2c: buses: add i2c bus driver for NVIDIA GPU

2018-08-30 Thread Wolfram Sang
On Wed, Aug 29, 2018 at 05:33:17PM -0700, ajayk...@gmail.com wrote:
> From: Ajay Gupta 

Can you add your full name to the gmail address, too? That would make
patch processing a tad easier.

Thanks,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCH 4.18 REGRESSION fix 0/2] typec: tcpm: Fix current-limit for non PD charging

2018-07-01 Thread Wolfram Sang

> grouped together. Wolfgang, can we have your ack for Greg merging both
> through the USB tree?

My name is "Wolfram".



signature.asc
Description: PGP signature


Re: [PATCH 4.18 REGRESSION fix 2/2] i2c-cht-wc: Fix bq24190 supplier

2018-07-01 Thread Wolfram Sang
On Sun, Jul 01, 2018 at 11:48:35AM +0200, Hans de Goede wrote:
> Commit f2a8aa053c17 ("typec: tcpm: Represent source supply through
> power_supply") moved the code to register a power_supply representing
> the device supplying power to the type-C connector, from the fusb302
> code to the generic tcpm code.
> 
> This has caused the power-supply registered by the fusb302 driver,
> which determines how much current the bq24190 can draw, to change name
> from "fusb302-typec-source" to "tcpm-source-psy-i2c-fusb302".
> 
> Fixes: f2a8aa053c17 ("typec: tcpm: Represent source supply through...")
> Cc: Adam Thomson 
> Signed-off-by: Hans de Goede 

Acked-by: Wolfram Sang 



signature.asc
Description: PGP signature


Re: [RFC 05/10] i2c: s3c2410: Remove support for Exynos5440

2018-04-28 Thread Wolfram Sang
On Tue, Apr 24, 2018 at 10:32:34PM +0200, Krzysztof Kozlowski wrote:
> The Exynos5440 is not actively developed, there are no development
> boards available and probably there are no real products with it.
> Remove wide-tree support for Exynos5440.
> 
> Signed-off-by: Krzysztof Kozlowski 

Applied to for-next, thanks!



signature.asc
Description: PGP signature


[PATCH 00/61] tree-wide: simplify getting .drvdata

2018-04-19 Thread Wolfram Sang
I got tired of fixing this in Renesas drivers manually, so I took the big
hammer. Remove this cumbersome code pattern which got copy-pasted too much
already:

-   struct platform_device *pdev = to_platform_device(dev);
-   struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
+   struct ep93xx_keypad *keypad = dev_get_drvdata(dev);

I send this out as one patch per directory per subsystem. I think they should
be applied individually. If you prefer a broken out series per subsystem, I can
provide this as well. Just mail me.

A branch (tested by buildbot; only with all commits squashed into one commit
before) can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
coccinelle/get_drvdata

Open for other comments, suggestions, too, of course.

Here is the cocci-script I created (after  iterations by manually checking
samples):

@@
struct device* d;
identifier pdev;
expression *ptr;
@@
(
-   struct platform_device *pdev = to_platform_device(d);
|
-   struct platform_device *pdev;
...
-   pdev = to_platform_device(d);
)
<... when != pdev
-   &pdev->dev
+   d
...>

ptr =
-   platform_get_drvdata(pdev)
+   dev_get_drvdata(d)

<... when != pdev
-   &pdev->dev
+   d
...>

Kind regards,

   Wolfram


Wolfram Sang (61):
  ARM: plat-samsung: simplify getting .drvdata
  ata: simplify getting .drvdata
  auxdisplay: simplify getting .drvdata
  bus: simplify getting .drvdata
  clk: samsung: simplify getting .drvdata
  crypto: simplify getting .drvdata
  dma: simplify getting .drvdata
  dmaengine: dw: simplify getting .drvdata
  dmaengine: qcom: simplify getting .drvdata
  gpio: simplify getting .drvdata
  gpu: drm: msm: simplify getting .drvdata
  gpu: drm: msm: adreno: simplify getting .drvdata
  gpu: drm: msm: disp: mdp5: simplify getting .drvdata
  gpu: drm: msm: dsi: simplify getting .drvdata
  gpu: drm: omapdrm: displays: simplify getting .drvdata
  gpu: drm: vc4: simplify getting .drvdata
  hid: simplify getting .drvdata
  iio: common: cros_ec_sensors: simplify getting .drvdata
  iio: common: hid-sensors: simplify getting .drvdata
  input: keyboard: simplify getting .drvdata
  input: misc: simplify getting .drvdata
  input: mouse: simplify getting .drvdata
  input: touchscreen: simplify getting .drvdata
  iommu: simplify getting .drvdata
  media: platform: am437x: simplify getting .drvdata
  media: platform: exynos4-is: simplify getting .drvdata
  media: platform: s5p-mfc: simplify getting .drvdata
  mmc: host: simplify getting .drvdata
  mtd: devices: simplify getting .drvdata
  mtd: nand: onenand: simplify getting .drvdata
  net: dsa: simplify getting .drvdata
  net: ethernet: cadence: simplify getting .drvdata
  net: ethernet: davicom: simplify getting .drvdata
  net: ethernet: smsc: simplify getting .drvdata
  net: ethernet: ti: simplify getting .drvdata
  net: ethernet: wiznet: simplify getting .drvdata
  perf: simplify getting .drvdata
  pinctrl: simplify getting .drvdata
  pinctrl: intel: simplify getting .drvdata
  platform: x86: simplify getting .drvdata
  power: supply: simplify getting .drvdata
  ptp: simplify getting .drvdata
  pwm: simplify getting .drvdata
  rtc: simplify getting .drvdata
  slimbus: simplify getting .drvdata
  spi: simplify getting .drvdata
  staging: greybus: simplify getting .drvdata
  staging: iio: adc: simplify getting .drvdata
  staging: nvec: simplify getting .drvdata
  thermal: simplify getting .drvdata
  thermal: int340x_thermal: simplify getting .drvdata
  thermal: st: simplify getting .drvdata
  tty: serial: simplify getting .drvdata
  uio: simplify getting .drvdata
  usb: mtu3: simplify getting .drvdata
  usb: phy: simplify getting .drvdata
  video: fbdev: simplify getting .drvdata
  video: fbdev: omap2: omapfb: displays: simplify getting .drvdata
  watchdog: simplify getting .drvdata
  net: dsa: simplify getting .drvdata
  ASoC: atmel: simplify getting .drvdata

 arch/arm/plat-samsung/adc.c|  3 +-
 drivers/ata/pata_samsung_cf.c  |  8 ++---
 drivers/auxdisplay/arm-charlcd.c   |  6 ++--
 drivers/bus/brcmstb_gisb.c | 12 +++
 drivers/clk/samsung/clk-s3c2410-dclk.c |  6 ++--
 drivers/crypto/exynos-rng.c|  6 ++--
 drivers/crypto/picoxcell_crypto.c  |  6 ++--
 drivers/dma/at_hdmac.c |  9 ++---
 drivers/dma/at_xdmac.c |  9 ++---
 drivers/dma/dw/platform.c  |  6 ++--
 drivers/dma/fsldma.c   |  6 ++--
 drivers/dma/idma64.c   |  6 ++--
 drivers/dma/qcom/hidma.c   |  3 +-
 drivers/dma/qcom/hidma_mgmt_sys.c  |  6 ++--
 drivers/dma/ste_dma40.c| 12 +++
 drivers/dma/txx9dmac.c  

[PATCH 56/61] usb: phy: simplify getting .drvdata

2018-04-19 Thread Wolfram Sang
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang 
---

Build tested only. buildbot is happy. Please apply individually.

 drivers/usb/phy/phy-am335x.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c
index b36fa8b953d0..27bdb7222527 100644
--- a/drivers/usb/phy/phy-am335x.c
+++ b/drivers/usb/phy/phy-am335x.c
@@ -96,8 +96,7 @@ static int am335x_phy_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int am335x_phy_suspend(struct device *dev)
 {
-   struct platform_device  *pdev = to_platform_device(dev);
-   struct am335x_phy *am_phy = platform_get_drvdata(pdev);
+   struct am335x_phy *am_phy = dev_get_drvdata(dev);
 
/*
 * Enable phy wakeup only if dev->power.can_wakeup is true.
@@ -117,8 +116,7 @@ static int am335x_phy_suspend(struct device *dev)
 
 static int am335x_phy_resume(struct device *dev)
 {
-   struct platform_device  *pdev = to_platform_device(dev);
-   struct am335x_phy   *am_phy = platform_get_drvdata(pdev);
+   struct am335x_phy   *am_phy = dev_get_drvdata(dev);
 
phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, true);
 
-- 
2.11.0

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


[PATCH 55/61] usb: mtu3: simplify getting .drvdata

2018-04-19 Thread Wolfram Sang
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang 
---

Build tested only. buildbot is happy. Please apply individually.

 drivers/usb/mtu3/mtu3_plat.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index 628d5ce356ca..46551f6d16fd 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -447,8 +447,7 @@ static int mtu3_remove(struct platform_device *pdev)
  */
 static int __maybe_unused mtu3_suspend(struct device *dev)
 {
-   struct platform_device *pdev = to_platform_device(dev);
-   struct ssusb_mtk *ssusb = platform_get_drvdata(pdev);
+   struct ssusb_mtk *ssusb = dev_get_drvdata(dev);
 
dev_dbg(dev, "%s\n", __func__);
 
@@ -466,8 +465,7 @@ static int __maybe_unused mtu3_suspend(struct device *dev)
 
 static int __maybe_unused mtu3_resume(struct device *dev)
 {
-   struct platform_device *pdev = to_platform_device(dev);
-   struct ssusb_mtk *ssusb = platform_get_drvdata(pdev);
+   struct ssusb_mtk *ssusb = dev_get_drvdata(dev);
int ret;
 
dev_dbg(dev, "%s\n", __func__);
-- 
2.11.0

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


Re: [PATCH] usb: gadget: udc: change comparison to bitshift when dealing with a mask

2018-02-06 Thread Wolfram Sang
On Tue, Feb 06, 2018 at 09:50:40AM +0100, Wolfram Sang wrote:
> Due to a typo, the mask was destroyed by a comparison instead of a bit
> shift.
> 
> Reported-by: Geert Uytterhoeven 
> Signed-off-by: Wolfram Sang 
> ---
> Only build tested.

Add. note: according to 'git grep', this macro is unused currently, so
no regression.



signature.asc
Description: PGP signature


[PATCH] usb: gadget: udc: change comparison to bitshift when dealing with a mask

2018-02-06 Thread Wolfram Sang
Due to a typo, the mask was destroyed by a comparison instead of a bit
shift.

Reported-by: Geert Uytterhoeven 
Signed-off-by: Wolfram Sang 
---
Only build tested.

 drivers/usb/gadget/udc/goku_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/goku_udc.h 
b/drivers/usb/gadget/udc/goku_udc.h
index 26601bf4e7a935..70023d40107997 100644
--- a/drivers/usb/gadget/udc/goku_udc.h
+++ b/drivers/usb/gadget/udc/goku_udc.h
@@ -25,7 +25,7 @@ struct goku_udc_regs {
 #  define INT_EP1DATASET   0x00040
 #  define INT_EP2DATASET   0x00080
 #  define INT_EP3DATASET   0x00100
-#define INT_EPnNAK(n)  (0x00100 < (n)) /* 0 < n < 4 */
+#define INT_EPnNAK(n)  (0x00100 << (n))/* 0 < n < 4 */
 #  define INT_EP1NAK   0x00200
 #  define INT_EP2NAK   0x00400
 #  define INT_EP3NAK   0x00800
-- 
2.11.0

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


Re: [PATCH 3/3] mfd: twl: move header file out of I2C realm

2017-08-14 Thread Wolfram Sang
> Acked-by: Daniel Thompson 

Added, thanks!



signature.asc
Description: PGP signature


Re: [PATCH 2/3] mfd: tps65010: move header file out of I2C realm

2017-08-14 Thread Wolfram Sang

> > Even if it doesn't, it still requires Acks.
> 
> As long as this has been compile tested with omap1_defconfig:
> 
> Acked-by: Tony Lindgren 

Hah, just in time. I was about to send out the new version, thanks! :D

buildbot did test it and I did compile tests, too.



signature.asc
Description: PGP signature


Re: [PATCH 3/3] mfd: twl: move header file out of I2C realm

2017-08-14 Thread Wolfram Sang

> > Given the triviality of the change for non-MFD subsystems, can we apply
> > this for 4.14?
> 
> I can't apply anything without Acks for *all* of the subsystems above.

Well, there are cases when you can. Those should be exceptions and well
justified, of course.

> My suggestion would be to collect the Acks you've received up until
> this point and identify which SS's are still lacking in change log
> section of a RESEND.

I agree, though, that I can try a second round to get the acks.



signature.asc
Description: PGP signature


Re: [PATCH 3/3] mfd: twl: move header file out of I2C realm

2017-08-13 Thread Wolfram Sang
On Thu, Jul 06, 2017 at 08:03:52AM +0100, Lee Jones wrote:
> On Thu, 06 Jul 2017, Thierry Reding wrote:
> 
> > On Mon, May 22, 2017 at 12:02:10AM +0200, Wolfram Sang wrote:
> > > include/linux/i2c is not for client devices. Move the header file to a
> > > more appropriate location.
> > > 
> > > Signed-off-by: Wolfram Sang 
> > > ---
> > >  arch/arm/mach-omap2/common.h| 2 +-
> > >  arch/arm/mach-omap2/omap_twl.c  | 2 +-
> > >  drivers/gpio/gpio-twl4030.c | 2 +-
> > >  drivers/iio/adc/twl4030-madc.c  | 2 +-
> > >  drivers/iio/adc/twl6030-gpadc.c | 2 +-
> > >  drivers/input/keyboard/twl4030_keypad.c | 2 +-
> > >  drivers/input/misc/twl4030-pwrbutton.c  | 2 +-
> > >  drivers/input/misc/twl4030-vibra.c  | 2 +-
> > >  drivers/mfd/twl-core.c  | 6 +++---
> > >  drivers/mfd/twl4030-audio.c | 2 +-
> > >  drivers/mfd/twl4030-irq.c   | 2 +-
> > >  drivers/mfd/twl4030-power.c | 2 +-
> > >  drivers/mfd/twl6030-irq.c   | 2 +-
> > >  drivers/phy/phy-twl4030-usb.c   | 2 +-
> > >  drivers/power/supply/twl4030_charger.c  | 2 +-
> > >  drivers/pwm/pwm-twl-led.c   | 2 +-
> > >  drivers/pwm/pwm-twl.c   | 2 +-
> > >  drivers/regulator/twl-regulator.c   | 2 +-
> > >  drivers/regulator/twl6030-regulator.c   | 2 +-
> > >  drivers/rtc/rtc-twl.c   | 2 +-
> > >  drivers/usb/phy/phy-twl6030-usb.c   | 2 +-
> > >  drivers/video/backlight/pandora_bl.c| 2 +-
> > >  drivers/watchdog/twl4030_wdt.c  | 2 +-
> > >  include/linux/{i2c => mfd}/twl.h| 0
> > >  sound/soc/codecs/twl4030.c  | 2 +-
> > >  25 files changed, 26 insertions(+), 26 deletions(-)
> > >  rename include/linux/{i2c => mfd}/twl.h (100%)
> > 
> > I didn't see this get applied yet, so just in case anyone was waiting
> > for me (this is trivial, so I don't think there's a need):
> 
> You're not the last. :)

Given the triviality of the change for non-MFD subsystems, can we apply
this for 4.14?



signature.asc
Description: PGP signature


Re: [PATCH 2/3] mfd: tps65010: move header file out of I2C realm

2017-08-13 Thread Wolfram Sang
On Tue, May 23, 2017 at 08:18:19AM +0100, Lee Jones wrote:
> On Mon, 22 May 2017, Wolfram Sang wrote:
> 
> > include/linux/i2c is not for client devices. Move the header file to a
> > more appropriate location.
> > 
> > Signed-off-by: Wolfram Sang 
> > ---
> >  arch/arm/mach-omap1/board-h2-mmc.c  | 2 +-
> >  arch/arm/mach-omap1/board-h2.c  | 2 +-
> >  arch/arm/mach-omap1/board-h3-mmc.c  | 2 +-
> >  arch/arm/mach-omap1/board-h3.c  | 2 +-
> >  arch/arm/mach-omap1/board-osk.c | 2 +-
> >  arch/arm/mach-s3c24xx/mach-osiris-dvs.c | 2 +-
> >  arch/arm/mach-s3c24xx/mach-osiris.c | 2 +-
> 
> >  drivers/mfd/tps65010.c  | 2 +-
> 
> For my own reference:
>   Acked-for-MFD-by: Lee Jones 

Same here: ok for 4.14 or something needed?



signature.asc
Description: PGP signature


Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang

> So, if I2C is a bit different, then it might simply make sense to keep
> the function local for I2C now? This seems like a sensible start to me
> meanwhile.

Then again, the DMA API would be for drivers. If the USB core wants to
check for capable buffers, such a helper might be nice nonetheless.
Especially if the USB core needs the check in at least 3 places.



signature.asc
Description: PGP signature


Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang

> > Possibly more useful would be a variant of (IIRC) dma_map_for_device()
> > that will allocate a suitable bounce buffer for non-dma memory.
> > I think it can already do so for memory that is outside the address
> > range that the device can address (eg for a 32bit PCIe master in 64bit
> > system).
> > 
> 
> Such generic DMA API would be greatly useful!
> 
> I tried adding bounce buffers support to handle vmalloc'd buffers in
> MTD/SPI subsystem. But, there was a need felt for generic DMA API that
> can allocate bounce buffer for non-dma'able buffers that all drivers can
> make use of[1][2]

Yes, I see this DMA API would make sense for subsystems like SPI, MTD or
USB. For I2C, I don't think it makes a lot of sense because DMA is
rarely used there. Most hardware doesn't even have DMA support and if
so, the drivers apply a threshold (say 8 bytes) because most I2C
transfers are smaller and setting up DMA for that simply doesn't pay
off. And we are still talking of a mostly 100 or 400 kHz bus here.

So, I'd prefer a lightweight helper function telling if DMA is
possible/feasible for a given I2C message. If so, do it. If not, falling
back to PIO might be good enough for now. We can implement bounce buffer
support in the above helper function later. I don't really want to
enforce DMA capable buffers for I2C transactions when DMA is so rarely
needed there.

So, if I2C is a bit different, then it might simply make sense to keep
the function local for I2C now? This seems like a sensible start to me
meanwhile.

Thanks to all for the helpful input here!



signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-31 Thread Wolfram Sang

> > +/* only works in process context because of stack detection */
> > +static inline bool is_dma_capable_addr(void *addr)
> > +{
> > +   return !(is_vmalloc_or_module_addr(addr) ||
> > +object_is_on_stack(addr));
> 
> This does not catch kmap'ed buffers which are not directly DMA'able.
> I would suggest to use virt_addr_valid() instead. Something like:
> 
>   return (virt_addr_valid(addr) && !object_is_on_stack(addr));

Hehe, here is the part of the commit message I have for this code:

===

Second note: I am not even sure the checks complete (kmapped mem?). But
that just strengthens the argument of having on centralized place IMO :)

===

So, thanks for the heads up!



signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

2017-05-28 Thread Wolfram Sang
On Fri, May 05, 2017 at 02:08:31PM -0700, Florian Fainelli wrote:
> On 04/25/2017 05:56 PM, Florian Fainelli wrote:
> > Changes in v3:
> > 
> > - added check in usb_gadget_map_request_by_dev (Felipe), new patch
> > - improved commit message description (Clemens)
> > - added additiona checks for urb->setup_packet (Alan)
> > 
> > Changes in v2:
> > 
> > - moved the check from usb_start_wait_urb() to usb_hcd_map_urb_for_dma()
> 
> Is this version looking good now? Thanks!

So, it seems I am in a similar situation with the I2C subsystem right
now. I need to check the message buffers if they are DMA capable.

Because you have basically the same checks in 3 different places, and I
need something similar for I2C, I wondered about a generic place to put
these checks. Especially since we want future improvements to these
checks applied everywhere immediately. Here is a small diff on what I
have now:

===

dma-mapping(?): introduce helper to check for DMA capable addresses

Introduce a helper to check if an address is DMA capable. Such a check
is subtle, so it is good to have a centralized place for it.

Note: I am absolutely not sure if dma-mapping.h is a good place for such
a function. I just couldn't think of a better one for now.

Second note: I am not even sure the checks are complete (kmapped mem?).
I am not an MM expert. But that just strengthens the argument of having
on centralized place IMO.

Signed-off-by: Wolfram Sang 


diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 5dea98358c05c4..777a37b395ff19 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1584,7 +1584,7 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct 
urb *urb,
ret = -EAGAIN;
else
urb->transfer_flags |= URB_DMA_MAP_PAGE;
-   } else if (is_vmalloc_addr(urb->transfer_buffer)) {
+   } else if (!is_dma_capable_addr(urb->transfer_buffer)) {
WARN_ONCE(1, "transfer buffer not dma 
capable\n");
ret = -EAGAIN;
} else {
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 4f3eecedca2d7c..da8c1230302505 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -10,6 +10,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /**
  * List of possible attributes associated with a DMA mapping. The semantics
@@ -818,4 +820,10 @@ static inline int dma_mmap_wc(struct device *dev,
 #define dma_unmap_len_set(PTR, LEN_NAME, VAL)do { } while (0)
 #endif
 
+/* only works in process context because of stack detection */
+static inline bool is_dma_capable_addr(void *addr)
+{
+   return !(is_vmalloc_or_module_addr(addr) ||
+object_is_on_stack(addr));
+}
 #endif
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 34a1c3e46ed725..47de0c0a700e7c 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -261,6 +261,7 @@ int is_vmalloc_or_module_addr(const void *x)
 #endif
return is_vmalloc_addr(x);
 }
+EXPORT_SYMBOL_GPL(is_vmalloc_or_module_addr);
 
 /*
  * Walk a vmap address to the struct page it maps.

===

The WIP branch containing also the I2C parts can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
renesas/topic/i2c-core-dma

I think the whole series needs 1 or 2 days more before I send out an
RFC, but I thought I'll let you know about my idea already.

Thanks and kind regards,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCH 3/3] mfd: twl: move header file out of I2C realm

2017-05-23 Thread Wolfram Sang

> For my own reference:
>   Acked-for-MFD-by: Lee Jones 
> 
> I guess this will be going through the MFD tree?

I'd prefer that, yes. Thanks!



signature.asc
Description: PGP signature


Re: [PATCH 3/3] mfd: twl: move header file out of I2C realm

2017-05-22 Thread Wolfram Sang
On Mon, May 22, 2017 at 10:52:43AM +0100, Mark Brown wrote:
> On Mon, May 22, 2017 at 12:02:10AM +0200, Wolfram Sang wrote:
> > include/linux/i2c is not for client devices. Move the header file to a
> > more appropriate location.
> 
> Acked-by: Mark Brown 

Thanks!

> I'm missing the rest of the series and/or the cover letter...

I meanwhile send cover letters only to all mailing lists involved. I
used to CC the individuals, too, until those messages were rejected
because the CC list grew too large :( And I really only CCed maintainers
then, no git history used.

If you were not CCed on the other patches, then you are likely not
listed as a maintainer for them?



signature.asc
Description: PGP signature


[PATCH 2/3] mfd: tps65010: move header file out of I2C realm

2017-05-21 Thread Wolfram Sang
include/linux/i2c is not for client devices. Move the header file to a
more appropriate location.

Signed-off-by: Wolfram Sang 
---
 arch/arm/mach-omap1/board-h2-mmc.c  | 2 +-
 arch/arm/mach-omap1/board-h2.c  | 2 +-
 arch/arm/mach-omap1/board-h3-mmc.c  | 2 +-
 arch/arm/mach-omap1/board-h3.c  | 2 +-
 arch/arm/mach-omap1/board-osk.c | 2 +-
 arch/arm/mach-s3c24xx/mach-osiris-dvs.c | 2 +-
 arch/arm/mach-s3c24xx/mach-osiris.c | 2 +-
 drivers/mfd/tps65010.c  | 2 +-
 drivers/usb/host/ohci-omap.c| 2 +-
 drivers/usb/phy/phy-isp1301-omap.c  | 2 +-
 drivers/video/fbdev/omap/lcd_h3.c   | 2 +-
 include/linux/{i2c => mfd}/tps65010.h   | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)
 rename include/linux/{i2c => mfd}/tps65010.h (99%)

diff --git a/arch/arm/mach-omap1/board-h2-mmc.c 
b/arch/arm/mach-omap1/board-h2-mmc.c
index 357be2debc9da8..91bda9c802ff38 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "board-h2.h"
 #include "mmc.h"
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 675254ee4b1e93..dece47d76282ac 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c 
b/arch/arm/mach-omap1/board-h3-mmc.c
index 4f58bfa5e7549e..692c267a9a9052 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include "common.h"
 #include "board-h3.h"
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index e62f9d454f1005..6d32beeb2d8857 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 4dfb995048103b..f20361b8ffb6e0 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -38,7 +38,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c 
b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
index 262ab07447483a..6cac7da15e2b0d 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c 
b/arch/arm/mach-s3c24xx/mach-osiris.c
index 70b0eb7d31347f..64b1a0b7b803a1 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index d829a6131f09e5..2ab67386b4ef1e 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -32,7 +32,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index a4d814b7f38066..91393ec7d8503c 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -53,7 +53,7 @@
 #define DRIVER_DESC "OHCI OMAP driver"
 
 #ifdef CONFIG_TPS65010
-#include 
+#include 
 #else
 
 #define LOW0
diff --git a/drivers/usb/phy/phy-isp1301-omap.c 
b/drivers/usb/phy/phy-isp1301-omap.c
index 042c5a8fd423d8..c6052c814bcc24 100644
--- a/drivers/usb/phy/phy-isp1301-omap.c
+++ b/drivers/usb/phy/phy-isp1301-omap.c
@@ -96,7 +96,7 @@ struct isp1301 {
 
 #if IS_REACHABLE(CONFIG_TPS65010)
 
-#include 
+#include 
 
 #else
 
diff --git a/drivers/video/fbdev/omap/lcd_h3.c 
b/drivers/video/fbdev/omap/lcd_h3.c
index 9d2da146813ef0..796f4634c4c6f1 100644
--- a/drivers/video/fbdev/omap/lcd_h3.c
+++ b/drivers/video/fbdev/omap/lcd_h3.c
@@ -21,7 +21,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "omapfb.h"
diff --git a/include/linux/i2c/tps65010.h b/include/linux/mfd/tps65010.h
similarity index 99%
rename from include/linux/i2c/tps65010.h
rename to include/linux/mfd/tps65010.h
index 08aa92278d71cd..a1fb9bc5311de4 100644
--- a/include/linux/i2c/tps65010.h
+++ b/include/linux/mfd/tps65010.h
@@ -1,4 +1,4 @@
-/* linux/i2c/tps65010.h
+/* linux/mfd/tps65010.h
  *
  * Functions to access TPS65010 power management device.
  *
-- 
2.11.0

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


[PATCH 3/3] mfd: twl: move header file out of I2C realm

2017-05-21 Thread Wolfram Sang
include/linux/i2c is not for client devices. Move the header file to a
more appropriate location.

Signed-off-by: Wolfram Sang 
---
 arch/arm/mach-omap2/common.h| 2 +-
 arch/arm/mach-omap2/omap_twl.c  | 2 +-
 drivers/gpio/gpio-twl4030.c | 2 +-
 drivers/iio/adc/twl4030-madc.c  | 2 +-
 drivers/iio/adc/twl6030-gpadc.c | 2 +-
 drivers/input/keyboard/twl4030_keypad.c | 2 +-
 drivers/input/misc/twl4030-pwrbutton.c  | 2 +-
 drivers/input/misc/twl4030-vibra.c  | 2 +-
 drivers/mfd/twl-core.c  | 6 +++---
 drivers/mfd/twl4030-audio.c | 2 +-
 drivers/mfd/twl4030-irq.c   | 2 +-
 drivers/mfd/twl4030-power.c | 2 +-
 drivers/mfd/twl6030-irq.c   | 2 +-
 drivers/phy/phy-twl4030-usb.c   | 2 +-
 drivers/power/supply/twl4030_charger.c  | 2 +-
 drivers/pwm/pwm-twl-led.c   | 2 +-
 drivers/pwm/pwm-twl.c   | 2 +-
 drivers/regulator/twl-regulator.c   | 2 +-
 drivers/regulator/twl6030-regulator.c   | 2 +-
 drivers/rtc/rtc-twl.c   | 2 +-
 drivers/usb/phy/phy-twl6030-usb.c   | 2 +-
 drivers/video/backlight/pandora_bl.c| 2 +-
 drivers/watchdog/twl4030_wdt.c  | 2 +-
 include/linux/{i2c => mfd}/twl.h| 0
 sound/soc/codecs/twl4030.c  | 2 +-
 25 files changed, 26 insertions(+), 26 deletions(-)
 rename include/linux/{i2c => mfd}/twl.h (100%)

diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 8cc6338fcb1288..b5ad7fcb80ed24 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -29,7 +29,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 1346b3ab34a5e3..295124b248ae3f 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "soc.h"
 #include "voltage.h"
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 24f388ed46d4c4..9b511df5450eb6 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 /*
  * The GPIO "subchip" supports 18 GPIOs which can be configured as
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index 0c74869a540ad3..5a64eda1652061 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -35,7 +35,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
index becbb0aef232b9..bc0e60b9da452e 100644
--- a/drivers/iio/adc/twl6030-gpadc.c
+++ b/drivers/iio/adc/twl6030-gpadc.c
@@ -33,7 +33,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/input/keyboard/twl4030_keypad.c 
b/drivers/input/keyboard/twl4030_keypad.c
index 39e72b3219d8a4..f9f98ef1d98e3f 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -30,7 +30,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/input/misc/twl4030-pwrbutton.c 
b/drivers/input/misc/twl4030-pwrbutton.c
index 1c13005b228fa7..b307cca1702226 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #define PWR_PWRON_IRQ (1 << 0)
 
diff --git a/drivers/input/misc/twl4030-vibra.c 
b/drivers/input/misc/twl4030-vibra.c
index caa5a62c42fbe0..6c51d404874bbd 100644
--- a/drivers/input/misc/twl4030-vibra.c
+++ b/drivers/input/misc/twl4030-vibra.c
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index c64615dca2bd33..2a09dde4ca6efc 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -44,7 +44,7 @@
 #include 
 
 #include 
-#include 
+#include 
 
 /* Register descriptions for audio */
 #include 
@@ -173,7 +173,7 @@ static struct twl_private *twl_priv;
 static struct twl_mapping twl4030_map[] = {
/*
 * NOTE:  don't change this table without updating the
-*  defines for TWL4030_MODULE_*
+*  defines for TWL4030_MODULE_*
 * so they continue to match the order in this table.
 */
 
@@ -344,7 +344,7 @@ static const struct regmap_config twl4030_regmap_config[4] 
= {
 static struct twl_mapping twl6030_map[] = {
/*
 * NOTE:  don't change this table without updating the
-*  defines for TWL4030_MODULE_*
+*  defines for TWL4030_MODULE_*
 * so they continue to match the order in this table.
 */
 
diff --git a/drivers/mfd

[PATCH 0/3] mfd: move include files out of include/linux/i2c

2017-05-21 Thread Wolfram Sang
It doesn't make sense to use include/linux/i2c for client drivers which may in
fact rather be hwmon or input or whatever devices. As a result, I want to
deprecate include/linux/i2c for good. This series moves the include files to a
better location, for the mfd subsystem to include/linux/mfd. Because of twl.h,
this touches quite some subsystems, but I still think it is worth it.

I prefer the series to go upstream via the subsystem tree; if you prefer that I
take it via I2C, just let me know.

No runtime testing because of no HW, but buildbot is happy with this series at
least. A branch can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/platform_data

Thanks and kind regards,

   Wolfram


Wolfram Sang (3):
  mfd: dm355evm_msp: move header file out of I2C realm
  mfd: tps65010: move header file out of I2C realm
  mfd: twl: move header file out of I2C realm

 arch/arm/mach-omap1/board-h2-mmc.c| 2 +-
 arch/arm/mach-omap1/board-h2.c| 2 +-
 arch/arm/mach-omap1/board-h3-mmc.c| 2 +-
 arch/arm/mach-omap1/board-h3.c| 2 +-
 arch/arm/mach-omap1/board-osk.c   | 2 +-
 arch/arm/mach-omap2/common.h  | 2 +-
 arch/arm/mach-omap2/omap_twl.c| 2 +-
 arch/arm/mach-s3c24xx/mach-osiris-dvs.c   | 2 +-
 arch/arm/mach-s3c24xx/mach-osiris.c   | 2 +-
 drivers/gpio/gpio-twl4030.c   | 2 +-
 drivers/iio/adc/twl4030-madc.c| 2 +-
 drivers/iio/adc/twl6030-gpadc.c   | 2 +-
 drivers/input/keyboard/twl4030_keypad.c   | 2 +-
 drivers/input/misc/dm355evm_keys.c| 2 +-
 drivers/input/misc/twl4030-pwrbutton.c| 2 +-
 drivers/input/misc/twl4030-vibra.c| 2 +-
 drivers/mfd/dm355evm_msp.c| 2 +-
 drivers/mfd/tps65010.c| 2 +-
 drivers/mfd/twl-core.c| 6 +++---
 drivers/mfd/twl4030-audio.c   | 2 +-
 drivers/mfd/twl4030-irq.c | 2 +-
 drivers/mfd/twl4030-power.c   | 2 +-
 drivers/mfd/twl6030-irq.c | 2 +-
 drivers/phy/phy-twl4030-usb.c | 2 +-
 drivers/power/supply/twl4030_charger.c| 2 +-
 drivers/pwm/pwm-twl-led.c | 2 +-
 drivers/pwm/pwm-twl.c | 2 +-
 drivers/regulator/twl-regulator.c | 2 +-
 drivers/regulator/twl6030-regulator.c | 2 +-
 drivers/rtc/rtc-dm355evm.c| 2 +-
 drivers/rtc/rtc-twl.c | 2 +-
 drivers/usb/host/ohci-omap.c  | 2 +-
 drivers/usb/phy/phy-isp1301-omap.c| 2 +-
 drivers/usb/phy/phy-twl6030-usb.c | 2 +-
 drivers/video/backlight/pandora_bl.c  | 2 +-
 drivers/video/fbdev/omap/lcd_h3.c | 2 +-
 drivers/watchdog/twl4030_wdt.c| 2 +-
 include/linux/{i2c => mfd}/dm355evm_msp.h | 0
 include/linux/{i2c => mfd}/tps65010.h | 2 +-
 include/linux/{i2c => mfd}/twl.h  | 0
 sound/soc/codecs/twl4030.c| 2 +-
 41 files changed, 41 insertions(+), 41 deletions(-)
 rename include/linux/{i2c => mfd}/dm355evm_msp.h (100%)
 rename include/linux/{i2c => mfd}/tps65010.h (99%)
 rename include/linux/{i2c => mfd}/twl.h (100%)

-- 
2.11.0

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


Re: [PATCH 2/3 v2] i2c: i2c-piix4: Use the common mutex

2017-04-19 Thread Wolfram Sang
On Mon, Apr 03, 2017 at 09:51:32AM +0200, Zoltan Boszormenyi wrote:
> Use the common mutex from driver/usb/host/pci-quirks.c in the
> i2c-piix4 driver to synchronize access to the I/O port pair
> 0xcd6 / 0xcd7.
> 
> At the same time, remove the request_region() call to reserve
> these I/O ports, so the sp5100_tco watchdog driver can also
> load. The mutex is enough to protect the I/O port accesses.
> This is an old regression in Linux 4.4-rc4, caused by:
> 
> v2: Explicit extern reference for sb800_mutex
> 
> commit 2fee61d22e606fc99ade9079fda15fdee83ec33e
> Author: Christian Fetzer 
> Date:   Thu Nov 19 20:13:48 2015 +0100
> 
> i2c: piix4: Add support for multiplexed main adapter in SB800
> 
> Signed-off-by: Zoltan Boszormenyi 

Given the global mutex approach is accepted, the actual changes here
look okay to me. I'd really like a tag from Jean here, still. He is the
expert for this hardware which I barely know.



signature.asc
Description: PGP signature


[PATCH 07/44] usb: core: hub: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/core/hub.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 1d5fc32d06d007..b48dc76385b652 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1823,10 +1823,8 @@ descriptor_error:
dev_info(&intf->dev, "USB hub found\n");
 
hub = kzalloc(sizeof(*hub), GFP_KERNEL);
-   if (!hub) {
-   dev_dbg(&intf->dev, "couldn't kmalloc hub struct\n");
+   if (!hub)
return -ENOMEM;
-   }
 
kref_init(&hub->kref);
hub->intfdev = &intf->dev;
@@ -5337,11 +5335,10 @@ static int descriptors_changed(struct usb_device *udev,
}
 
buf = kmalloc(len, GFP_NOIO);
-   if (buf == NULL) {
-   dev_err(&udev->dev, "no mem to re-read configs after reset\n");
+   if (!buf)
/* assume the worst */
return 1;
-   }
+
for (index = 0; index < udev->descriptor.bNumConfigurations; index++) {
old_length = le16_to_cpu(udev->config[index].desc.wTotalLength);
length = usb_get_descriptor(udev, USB_DT_CONFIG, index, buf,
-- 
2.9.3

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


[PATCH 06/44] usb: core: hcd: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/core/hcd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index d2e3f655c26f6c..a0c87b617eddea 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2517,10 +2517,8 @@ struct usb_hcd *usb_create_shared_hcd(const struct 
hc_driver *driver,
struct usb_hcd *hcd;
 
hcd = kzalloc(sizeof(*hcd) + driver->hcd_priv_size, GFP_KERNEL);
-   if (!hcd) {
-   dev_dbg (dev, "hcd alloc failed\n");
+   if (!hcd)
return NULL;
-   }
if (primary_hcd == NULL) {
hcd->address0_mutex = kmalloc(sizeof(*hcd->address0_mutex),
GFP_KERNEL);
-- 
2.9.3

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


[PATCH 02/44] usb: atm: speedtch: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/atm/speedtch.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 0270d1312f834f..5083eb5b0d5ed9 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -817,7 +817,6 @@ static int speedtch_bind(struct usbatm_data *usbatm,
instance = kzalloc(sizeof(*instance), GFP_KERNEL);
 
if (!instance) {
-   usb_err(usbatm, "%s: no memory for instance data!\n", __func__);
ret = -ENOMEM;
goto fail_release;
}
-- 
2.9.3

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


[PATCH 15/44] usb: host: max3421-hcd: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/host/max3421-hcd.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index 2f7690092a7ffb..369869a29ebd4d 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -1856,15 +1856,11 @@ max3421_probe(struct spi_device *spi)
INIT_LIST_HEAD(&max3421_hcd->ep_list);
 
max3421_hcd->tx = kmalloc(sizeof(*max3421_hcd->tx), GFP_KERNEL);
-   if (!max3421_hcd->tx) {
-   dev_err(&spi->dev, "failed to kmalloc tx buffer\n");
+   if (!max3421_hcd->tx)
goto error;
-   }
max3421_hcd->rx = kmalloc(sizeof(*max3421_hcd->rx), GFP_KERNEL);
-   if (!max3421_hcd->rx) {
-   dev_err(&spi->dev, "failed to kmalloc rx buffer\n");
+   if (!max3421_hcd->rx)
goto error;
-   }
 
max3421_hcd->spi_thread = kthread_run(max3421_spi_thread, hcd,
  "max3421_spi_thread");
-- 
2.9.3

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


[PATCH 31/44] usb: misc: usbsevseg: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/usbsevseg.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index 1fe6b73c22f300..a0ba5298160c56 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -128,10 +128,8 @@ static void update_display_visual(struct usb_sevsegdev 
*mydev, gfp_t mf)
return;
 
buffer = kzalloc(MAXLEN, mf);
-   if (!buffer) {
-   dev_err(&mydev->udev->dev, "out of memory\n");
+   if (!buffer)
return;
-   }
 
/* The device is right to left, where as you write left to right */
for (i = 0; i < mydev->textlength; i++)
@@ -346,10 +344,8 @@ static int sevseg_probe(struct usb_interface *interface,
int rc = -ENOMEM;
 
mydev = kzalloc(sizeof(struct usb_sevsegdev), GFP_KERNEL);
-   if (mydev == NULL) {
-   dev_err(&interface->dev, "Out of memory\n");
+   if (!mydev)
goto error_mem;
-   }
 
mydev->udev = usb_get_dev(udev);
mydev->intf = interface;
-- 
2.9.3

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


[PATCH 03/44] usb: atm: ueagle-atm: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/atm/ueagle-atm.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index f198291630d7dd..df67815f74e680 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2196,11 +2196,8 @@ static int uea_boot(struct uea_softc *sc)
load_XILINX_firmware(sc);
 
intr = kmalloc(size, GFP_KERNEL);
-   if (!intr) {
-   uea_err(INS_TO_USBDEV(sc),
-  "cannot allocate interrupt package\n");
+   if (!intr)
goto err0;
-   }
 
sc->urb_int = usb_alloc_urb(0, GFP_KERNEL);
if (!sc->urb_int)
@@ -2559,10 +2556,8 @@ static int uea_bind(struct usbatm_data *usbatm, struct 
usb_interface *intf,
}
 
sc = kzalloc(sizeof(struct uea_softc), GFP_KERNEL);
-   if (!sc) {
-   uea_err(usb, "uea_init: not enough memory !\n");
+   if (!sc)
return -ENOMEM;
-   }
 
sc->usb_dev = usb;
usbatm->driver_data = sc;
-- 
2.9.3

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


[PATCH 27/44] usb: misc: legousbtower: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/legousbtower.c | 16 
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 52b41fb66792eb..ece9b3c1eaac29 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -817,10 +817,8 @@ static int tower_probe (struct usb_interface *interface, 
const struct usb_device
 
dev = kmalloc (sizeof(struct lego_usb_tower), GFP_KERNEL);
 
-   if (dev == NULL) {
-   dev_err(idev, "Out of memory\n");
+   if (!dev)
goto exit;
-   }
 
mutex_init(&dev->lock);
 
@@ -871,23 +869,17 @@ static int tower_probe (struct usb_interface *interface, 
const struct usb_device
}
 
dev->read_buffer = kmalloc (read_buffer_size, GFP_KERNEL);
-   if (!dev->read_buffer) {
-   dev_err(idev, "Couldn't allocate read_buffer\n");
+   if (!dev->read_buffer)
goto error;
-   }
dev->interrupt_in_buffer = kmalloc 
(usb_endpoint_maxp(dev->interrupt_in_endpoint), GFP_KERNEL);
-   if (!dev->interrupt_in_buffer) {
-   dev_err(idev, "Couldn't allocate interrupt_in_buffer\n");
+   if (!dev->interrupt_in_buffer)
goto error;
-   }
dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_in_urb)
goto error;
dev->interrupt_out_buffer = kmalloc (write_buffer_size, GFP_KERNEL);
-   if (!dev->interrupt_out_buffer) {
-   dev_err(idev, "Couldn't allocate interrupt_out_buffer\n");
+   if (!dev->interrupt_out_buffer)
goto error;
-   }
dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_out_urb)
goto error;
-- 
2.9.3

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


[PATCH 23/44] usb: misc: ftdi-elan: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/ftdi-elan.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 45f303c1cc49ef..9beba9748d0f24 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -2733,7 +2733,6 @@ static int ftdi_elan_probe(struct usb_interface 
*interface,
ftdi->bulk_in_endpointAddr = endpoint->bEndpointAddress;
ftdi->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!ftdi->bulk_in_buffer) {
-   dev_err(&ftdi->udev->dev, "Could not allocate 
bulk_in_buffer\n");
retval = -ENOMEM;
goto error;
}
-- 
2.9.3

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


[PATCH 39/44] usb: storage: alauda: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/storage/alauda.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 1d8b03c8103053..878b4b8761f5a6 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -939,10 +939,8 @@ static int alauda_read_data(struct us_data *us, unsigned 
long address,
 
len = min(sectors, blocksize) * (pagesize + 64);
buffer = kmalloc(len, GFP_NOIO);
-   if (buffer == NULL) {
-   printk(KERN_WARNING "alauda_read_data: Out of memory\n");
+   if (!buffer)
return USB_STOR_TRANSPORT_ERROR;
-   }
 
/* Figure out the initial LBA and page */
lba = address >> blockshift;
@@ -1033,18 +1031,15 @@ static int alauda_write_data(struct us_data *us, 
unsigned long address,
 
len = min(sectors, blocksize) * pagesize;
buffer = kmalloc(len, GFP_NOIO);
-   if (buffer == NULL) {
-   printk(KERN_WARNING "alauda_write_data: Out of memory\n");
+   if (!buffer)
return USB_STOR_TRANSPORT_ERROR;
-   }
 
/*
 * We also need a temporary block buffer, where we read in the old data,
 * overwrite parts with the new data, and manipulate the redundancy data
 */
blockbuffer = kmalloc((pagesize + 64) * blocksize, GFP_NOIO);
-   if (blockbuffer == NULL) {
-   printk(KERN_WARNING "alauda_write_data: Out of memory\n");
+   if (!blockbuffer) {
kfree(buffer);
return USB_STOR_TRANSPORT_ERROR;
}
-- 
2.9.3

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


[PATCH 08/44] usb: core: message: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/core/message.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 0406a59f05510c..5ab5c1a81462b6 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1760,17 +1760,14 @@ int usb_set_configuration(struct usb_device *dev, int 
configuration)
nintf = cp->desc.bNumInterfaces;
new_interfaces = kmalloc(nintf * sizeof(*new_interfaces),
GFP_NOIO);
-   if (!new_interfaces) {
-   dev_err(&dev->dev, "Out of memory\n");
+   if (!new_interfaces)
return -ENOMEM;
-   }
 
for (; n < nintf; ++n) {
new_interfaces[n] = kzalloc(
sizeof(struct usb_interface),
GFP_NOIO);
if (!new_interfaces[n]) {
-   dev_err(&dev->dev, "Out of memory\n");
ret = -ENOMEM;
 free_interfaces:
while (--n >= 0)
-- 
2.9.3

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


[PATCH 19/44] usb: misc: adutux: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/adutux.c | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index c34a0b6980cdcd..564268fca07a02 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -672,8 +672,7 @@ static int adu_probe(struct usb_interface *interface,
 
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(struct adu_device), GFP_KERNEL);
-   if (dev == NULL) {
-   dev_err(&interface->dev, "Out of memory\n");
+   if (!dev) {
retval = -ENOMEM;
goto exit;
}
@@ -710,7 +709,6 @@ static int adu_probe(struct usb_interface *interface,
 
dev->read_buffer_primary = kmalloc((4 * in_end_size), GFP_KERNEL);
if (!dev->read_buffer_primary) {
-   dev_err(&interface->dev, "Couldn't allocate 
read_buffer_primary\n");
retval = -ENOMEM;
goto error;
}
@@ -723,7 +721,6 @@ static int adu_probe(struct usb_interface *interface,
 
dev->read_buffer_secondary = kmalloc((4 * in_end_size), GFP_KERNEL);
if (!dev->read_buffer_secondary) {
-   dev_err(&interface->dev, "Couldn't allocate 
read_buffer_secondary\n");
retval = -ENOMEM;
goto error;
}
@@ -735,10 +732,8 @@ static int adu_probe(struct usb_interface *interface,
memset(dev->read_buffer_secondary + (3 * in_end_size), 'h', 
in_end_size);
 
dev->interrupt_in_buffer = kmalloc(in_end_size, GFP_KERNEL);
-   if (!dev->interrupt_in_buffer) {
-   dev_err(&interface->dev, "Couldn't allocate 
interrupt_in_buffer\n");
+   if (!dev->interrupt_in_buffer)
goto error;
-   }
 
/* debug code prime the buffer */
memset(dev->interrupt_in_buffer, 'i', in_end_size);
@@ -747,10 +742,8 @@ static int adu_probe(struct usb_interface *interface,
if (!dev->interrupt_in_urb)
goto error;
dev->interrupt_out_buffer = kmalloc(out_end_size, GFP_KERNEL);
-   if (!dev->interrupt_out_buffer) {
-   dev_err(&interface->dev, "Couldn't allocate 
interrupt_out_buffer\n");
+   if (!dev->interrupt_out_buffer)
goto error;
-   }
dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_out_urb)
goto error;
-- 
2.9.3

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


[PATCH 30/44] usb: misc: usblcd: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/usblcd.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 1184390508e983..9f48419abc46b9 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -321,10 +321,8 @@ static int lcd_probe(struct usb_interface *interface,
 
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-   if (dev == NULL) {
-   dev_err(&interface->dev, "Out of memory\n");
+   if (!dev)
goto error;
-   }
kref_init(&dev->kref);
sema_init(&dev->limit_sem, USB_LCD_CONCURRENT_WRITES);
init_usb_anchor(&dev->submitted);
@@ -351,11 +349,8 @@ static int lcd_probe(struct usb_interface *interface,
dev->bulk_in_size = buffer_size;
dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-   if (!dev->bulk_in_buffer) {
-   dev_err(&interface->dev,
-   "Could not allocate bulk_in_buffer\n");
+   if (!dev->bulk_in_buffer)
goto error;
-   }
}
 
if (!dev->bulk_out_endpointAddr &&
-- 
2.9.3

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


[PATCH 35/44] usb: musb: da8xx: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/musb/da8xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index b03d3b867fca2f..3c4dd1658f28db 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -494,10 +494,8 @@ static int da8xx_probe(struct platform_device *pdev)
int ret = -ENOMEM;
 
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
-   if (!glue) {
-   dev_err(&pdev->dev, "failed to allocate glue context\n");
+   if (!glue)
goto err0;
-   }
 
clk = clk_get(&pdev->dev, "usb20");
if (IS_ERR(clk)) {
-- 
2.9.3

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


[PATCH 13/44] usb: gadget: udc: udc-xilinx: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/gadget/udc/udc-xilinx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/udc-xilinx.c 
b/drivers/usb/gadget/udc/udc-xilinx.c
index f8bf290f189444..588e2531b8b81e 100644
--- a/drivers/usb/gadget/udc/udc-xilinx.c
+++ b/drivers/usb/gadget/udc/udc-xilinx.c
@@ -973,10 +973,8 @@ static struct usb_request *xudc_ep_alloc_request(struct 
usb_ep *_ep,
 
udc = ep->udc;
req = kzalloc(sizeof(*req), gfp_flags);
-   if (!req) {
-   dev_err(udc->dev, "%s:not enough memory", __func__);
+   if (!req)
return NULL;
-   }
 
req->ep = ep;
INIT_LIST_HEAD(&req->queue);
-- 
2.9.3

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


[PATCH 38/44] usb: renesas_usbhs: pipe: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/renesas_usbhs/pipe.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index c238772b9e9e1a..9396a8c14af801 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -804,10 +804,8 @@ int usbhs_pipe_probe(struct usbhs_priv *priv)
}
 
info->pipe = kzalloc(sizeof(struct usbhs_pipe) * pipe_size, GFP_KERNEL);
-   if (!info->pipe) {
-   dev_err(dev, "Could not allocate pipe\n");
+   if (!info->pipe)
return -ENOMEM;
-   }
 
info->size = pipe_size;
 
-- 
2.9.3

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


[PATCH 11/44] usb: gadget: udc: fsl_qe_udc: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/gadget/udc/fsl_qe_udc.c | 16 
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c 
b/drivers/usb/gadget/udc/fsl_qe_udc.c
index cf8819a5c5b263..9d6b2c8eed4294 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -421,10 +421,8 @@ static int qe_ep_rxbd_update(struct qe_ep *ep)
bd = ep->rxbase;
 
ep->rxframe = kmalloc(sizeof(*ep->rxframe), GFP_ATOMIC);
-   if (ep->rxframe == NULL) {
-   dev_err(ep->udc->dev, "malloc rxframe failed\n");
+   if (!ep->rxframe)
return -ENOMEM;
-   }
 
qe_frame_init(ep->rxframe);
 
@@ -435,9 +433,7 @@ static int qe_ep_rxbd_update(struct qe_ep *ep)
 
size = (ep->ep.maxpacket + USB_CRC_SIZE + 2) * (bdring_len + 1);
ep->rxbuffer = kzalloc(size, GFP_ATOMIC);
-   if (ep->rxbuffer == NULL) {
-   dev_err(ep->udc->dev, "malloc rxbuffer failed,size=%d\n",
-   size);
+   if (!ep->rxbuffer) {
kfree(ep->rxframe);
return -ENOMEM;
}
@@ -668,10 +664,8 @@ static int qe_ep_init(struct qe_udc *udc,
 
if ((ep->tm == USBP_TM_CTL) || (ep->dir == USB_DIR_IN)) {
ep->txframe = kmalloc(sizeof(*ep->txframe), GFP_ATOMIC);
-   if (ep->txframe == NULL) {
-   dev_err(udc->dev, "malloc txframe failed\n");
+   if (!ep->txframe)
goto en_done2;
-   }
qe_frame_init(ep->txframe);
}
 
@@ -2347,10 +2341,8 @@ static struct qe_udc *qe_udc_config(struct 
platform_device *ofdev)
u32 offset;
 
udc = kzalloc(sizeof(*udc), GFP_KERNEL);
-   if (udc == NULL) {
-   dev_err(&ofdev->dev, "malloc udc failed\n");
+   if (!udc)
goto cleanup;
-   }
 
udc->dev = &ofdev->dev;
 
-- 
2.9.3

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


[PATCH 43/44] usb: wusbcore: security: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/wusbcore/security.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c
index b66faaf3e842e8..8c9421b69da00a 100644
--- a/drivers/usb/wusbcore/security.c
+++ b/drivers/usb/wusbcore/security.c
@@ -374,10 +374,8 @@ int wusb_dev_4way_handshake(struct wusbhc *wusbhc, struct 
wusb_dev *wusb_dev,
struct wusb_keydvt_out keydvt_out;
 
hs = kcalloc(3, sizeof(hs[0]), GFP_KERNEL);
-   if (hs == NULL) {
-   dev_err(dev, "can't allocate handshake data\n");
+   if (!hs)
goto error_kzalloc;
-   }
 
/* We need to turn encryption before beginning the 4way
 * hshake (WUSB1.0[.3.2.2]) */
-- 
2.9.3

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


[PATCH 10/44] usb: dwc2: gadget: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/dwc2/gadget.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index af46adfae41ca5..2ff03ae08e144d 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3908,17 +3908,13 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
 
hsotg->ctrl_buff = devm_kzalloc(hsotg->dev,
DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
-   if (!hsotg->ctrl_buff) {
-   dev_err(dev, "failed to allocate ctrl request buff\n");
+   if (!hsotg->ctrl_buff)
return -ENOMEM;
-   }
 
hsotg->ep0_buff = devm_kzalloc(hsotg->dev,
DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
-   if (!hsotg->ep0_buff) {
-   dev_err(dev, "failed to allocate ctrl reply buff\n");
+   if (!hsotg->ep0_buff)
return -ENOMEM;
-   }
 
ret = devm_request_irq(hsotg->dev, irq, dwc2_hsotg_irq, IRQF_SHARED,
dev_name(hsotg->dev), hsotg);
-- 
2.9.3

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


[PATCH 33/44] usb: misc: yurex: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/yurex.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index bb606bdc25e558..54e53ac4c08fd7 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -200,10 +200,8 @@ static int yurex_probe(struct usb_interface *interface, 
const struct usb_device_
 
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-   if (!dev) {
-   dev_err(&interface->dev, "Out of memory\n");
+   if (!dev)
goto error;
-   }
kref_init(&dev->kref);
mutex_init(&dev->io_mutex);
spin_lock_init(&dev->lock);
@@ -236,10 +234,8 @@ static int yurex_probe(struct usb_interface *interface, 
const struct usb_device_
 
/* allocate buffer for control req */
dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
-   if (!dev->cntl_req) {
-   dev_err(&interface->dev, "Could not allocate cntl_req\n");
+   if (!dev->cntl_req)
goto error;
-   }
 
/* allocate buffer for control msg */
dev->cntl_buffer = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE,
-- 
2.9.3

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


[PATCH 21/44] usb: misc: cypress_cy7c63: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/cypress_cy7c63.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/misc/cypress_cy7c63.c 
b/drivers/usb/misc/cypress_cy7c63.c
index 402b94dd253159..5c93a888c40e56 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -79,7 +79,6 @@ static int vendor_command(struct cypress *dev, unsigned char 
request,
/* allocate some memory for the i/o buffer*/
iobuf = kzalloc(CYPRESS_MAX_REQSIZE, GFP_KERNEL);
if (!iobuf) {
-   dev_err(&dev->udev->dev, "Out of memory!\n");
retval = -ENOMEM;
goto error;
}
@@ -208,10 +207,8 @@ static int cypress_probe(struct usb_interface *interface,
 
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-   if (dev == NULL) {
-   dev_err(&interface->dev, "Out of memory!\n");
+   if (!dev)
goto error_mem;
-   }
 
dev->udev = usb_get_dev(interface_to_usbdev(interface));
 
-- 
2.9.3

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


[PATCH 05/44] usb: class: usbtmc: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/class/usbtmc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 22c235adacb3ad..da4f2509f56775 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1476,10 +1476,8 @@ static int usbtmc_probe(struct usb_interface *intf,
/* allocate buffer for interrupt in */
data->iin_buffer = kmalloc(data->iin_wMaxPacketSize,
GFP_KERNEL);
-   if (!data->iin_buffer) {
-   dev_err(&intf->dev, "Failed to allocate int buf\n");
+   if (!data->iin_buffer)
goto error_register;
-   }
 
/* fill interrupt urb */
usb_fill_int_urb(data->iin_urb, data->usb_dev,
-- 
2.9.3

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


[PATCH 25/44] usb: misc: iowarrior: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/iowarrior.c | 20 ++--
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 7defa34dd4fa8b..095778ff984de2 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -278,7 +278,7 @@ static ssize_t iowarrior_read(struct file *file, char 
__user *buffer,
dev = file->private_data;
 
/* verify that the device wasn't unplugged */
-   if (dev == NULL || !dev->present)
+   if (!dev || !dev->present)
return -ENODEV;
 
dev_dbg(&dev->interface->dev, "minor %d, count = %zd\n",
@@ -480,9 +480,8 @@ static long iowarrior_ioctl(struct file *file, unsigned int 
cmd,
int io_res; /* checks for bytes read/written and 
copy_to/from_user results */
 
dev = file->private_data;
-   if (dev == NULL) {
+   if (!dev)
return -ENODEV;
-   }
 
buffer = kzalloc(dev->report_size, GFP_KERNEL);
if (!buffer)
@@ -652,9 +651,8 @@ static int iowarrior_release(struct inode *inode, struct 
file *file)
int retval = 0;
 
dev = file->private_data;
-   if (dev == NULL) {
+   if (!dev)
return -ENODEV;
-   }
 
dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor);
 
@@ -764,10 +762,8 @@ static int iowarrior_probe(struct usb_interface *interface,
 
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL);
-   if (dev == NULL) {
-   dev_err(&interface->dev, "Out of memory\n");
+   if (!dev)
return retval;
-   }
 
mutex_init(&dev->mutex);
 
@@ -813,10 +809,8 @@ static int iowarrior_probe(struct usb_interface *interface,
if (!dev->int_in_urb)
goto error;
dev->int_in_buffer = kmalloc(dev->report_size, GFP_KERNEL);
-   if (!dev->int_in_buffer) {
-   dev_err(&interface->dev, "Couldn't allocate int_in_buffer\n");
+   if (!dev->int_in_buffer)
goto error;
-   }
usb_fill_int_urb(dev->int_in_urb, dev->udev,
 usb_rcvintpipe(dev->udev,
dev->int_in_endpoint->bEndpointAddress),
@@ -827,10 +821,8 @@ static int iowarrior_probe(struct usb_interface *interface,
dev->read_queue =
kmalloc(((dev->report_size + 1) * MAX_INTERRUPT_BUFFER),
GFP_KERNEL);
-   if (!dev->read_queue) {
-   dev_err(&interface->dev, "Couldn't allocate read_queue\n");
+   if (!dev->read_queue)
goto error;
-   }
/* Get the serial-number of the chip */
memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial));
usb_string(udev, udev->descriptor.iSerialNumber, dev->chip_serial,
-- 
2.9.3

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


[PATCH 20/44] usb: misc: appledisplay: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/appledisplay.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index f7c48703347fb7..0b2617fe1c9b6f 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -239,7 +239,6 @@ static int appledisplay_probe(struct usb_interface *iface,
pdata = kzalloc(sizeof(struct appledisplay), GFP_KERNEL);
if (!pdata) {
retval = -ENOMEM;
-   dev_err(&iface->dev, "Out of memory\n");
goto error;
}
 
@@ -253,8 +252,6 @@ static int appledisplay_probe(struct usb_interface *iface,
pdata->msgdata = kmalloc(ACD_MSG_BUFFER_LEN, GFP_KERNEL);
if (!pdata->msgdata) {
retval = -ENOMEM;
-   dev_err(&iface->dev,
-   "Allocating buffer for control messages failed\n");
goto error;
}
 
-- 
2.9.3

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


[PATCH 26/44] usb: misc: ldusb: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/ldusb.c | 20 +---
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 84890791c2f830..9ca595632f171c 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -658,10 +658,8 @@ static int ld_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *
/* allocate memory for our device state and initialize it */
 
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-   if (dev == NULL) {
-   dev_err(&intf->dev, "Out of memory\n");
+   if (!dev)
goto exit;
-   }
mutex_init(&dev->mutex);
spin_lock_init(&dev->rbsl);
dev->intf = intf;
@@ -674,10 +672,8 @@ static int ld_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *
 (le16_to_cpu(udev->descriptor.idProduct) == 
USB_DEVICE_ID_LD_COM3LAB)) &&
(le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) {
buffer = kmalloc(256, GFP_KERNEL);
-   if (buffer == NULL) {
-   dev_err(&intf->dev, "Couldn't allocate string 
buffer\n");
+   if (!buffer)
goto error;
-   }
/* usb_string makes SETUP+STALL to leave always ControlReadLoop 
*/
usb_string(udev, 255, buffer, 256);
kfree(buffer);
@@ -704,25 +700,19 @@ static int ld_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *
 
dev->interrupt_in_endpoint_size = 
usb_endpoint_maxp(dev->interrupt_in_endpoint);
dev->ring_buffer = 
kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), 
GFP_KERNEL);
-   if (!dev->ring_buffer) {
-   dev_err(&intf->dev, "Couldn't allocate ring_buffer\n");
+   if (!dev->ring_buffer)
goto error;
-   }
dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, 
GFP_KERNEL);
-   if (!dev->interrupt_in_buffer) {
-   dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n");
+   if (!dev->interrupt_in_buffer)
goto error;
-   }
dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_in_urb)
goto error;
dev->interrupt_out_endpoint_size = dev->interrupt_out_endpoint ? 
usb_endpoint_maxp(dev->interrupt_out_endpoint) :
 
udev->descriptor.bMaxPacketSize0;
dev->interrupt_out_buffer = 
kmalloc(write_buffer_size*dev->interrupt_out_endpoint_size, GFP_KERNEL);
-   if (!dev->interrupt_out_buffer) {
-   dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n");
+   if (!dev->interrupt_out_buffer)
goto error;
-   }
dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_out_urb)
goto error;
-- 
2.9.3

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


[PATCH 29/44] usb: misc: trancevibrator: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/trancevibrator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/misc/trancevibrator.c 
b/drivers/usb/misc/trancevibrator.c
index 4145314a515b95..9795457723d86c 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -95,8 +95,7 @@ static int tv_probe(struct usb_interface *interface,
int retval;
 
dev = kzalloc(sizeof(struct trancevibrator), GFP_KERNEL);
-   if (dev == NULL) {
-   dev_err(&interface->dev, "Out of memory\n");
+   if (!dev) {
retval = -ENOMEM;
goto error;
}
-- 
2.9.3

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


[PATCH 36/44] usb: renesas_usbhs: mod_gadget: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/renesas_usbhs/mod_gadget.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c 
b/drivers/usb/renesas_usbhs/mod_gadget.c
index 92bc83b92d10d3..8e326ac00c9fed 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -335,7 +335,6 @@ static void __usbhsg_recip_send_status(struct usbhsg_gpriv 
*gpriv,
buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
if (!buf) {
usb_ep_free_request(&dcp->ep, req);
-   dev_err(dev, "recip data allocation fail\n");
return;
}
 
@@ -1062,14 +1061,11 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
int ret;
 
gpriv = kzalloc(sizeof(struct usbhsg_gpriv), GFP_KERNEL);
-   if (!gpriv) {
-   dev_err(dev, "Could not allocate gadget priv\n");
+   if (!gpriv)
return -ENOMEM;
-   }
 
uep = kzalloc(sizeof(struct usbhsg_uep) * pipe_size, GFP_KERNEL);
if (!uep) {
-   dev_err(dev, "Could not allocate ep\n");
ret = -ENOMEM;
goto usbhs_mod_gadget_probe_err_gpriv;
}
-- 
2.9.3

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


[PATCH 41/44] usb: usb-skeleton: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/usb-skeleton.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 89e02a7529b785..5133a0792eb041 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -499,10 +499,8 @@ static int skel_probe(struct usb_interface *interface,
 
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-   if (!dev) {
-   dev_err(&interface->dev, "Out of memory\n");
+   if (!dev)
goto error;
-   }
kref_init(&dev->kref);
sema_init(&dev->limit_sem, WRITES_IN_FLIGHT);
mutex_init(&dev->io_mutex);
@@ -526,11 +524,8 @@ static int skel_probe(struct usb_interface *interface,
dev->bulk_in_size = buffer_size;
dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-   if (!dev->bulk_in_buffer) {
-   dev_err(&interface->dev,
-   "Could not allocate bulk_in_buffer\n");
+   if (!dev->bulk_in_buffer)
goto error;
-   }
dev->bulk_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->bulk_in_urb)
goto error;
-- 
2.9.3

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


[PATCH 18/44] usb: host: xhci: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/host/xhci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 01d96c9b3a75b9..1a4ca02729c274 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -295,10 +295,8 @@ static int xhci_setup_msix(struct xhci_hcd *xhci)
xhci->msix_entries =
kmalloc((sizeof(struct msix_entry))*xhci->msix_count,
GFP_KERNEL);
-   if (!xhci->msix_entries) {
-   xhci_err(xhci, "Failed to allocate MSI-X entries\n");
+   if (!xhci->msix_entries)
return -ENOMEM;
-   }
 
for (i = 0; i < xhci->msix_count; i++) {
xhci->msix_entries[i].entry = i;
-- 
2.9.3

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


[PATCH 42/44] usb: wusbcore: crypto: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/wusbcore/crypto.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/wusbcore/crypto.c b/drivers/usb/wusbcore/crypto.c
index 33acd1599e99e9..79b2b628066d81 100644
--- a/drivers/usb/wusbcore/crypto.c
+++ b/drivers/usb/wusbcore/crypto.c
@@ -229,10 +229,8 @@ static int wusb_ccm_mac(struct crypto_skcipher *tfm_cbc,
zero_padding = sizeof(struct aes_ccm_block) - zero_padding;
dst_size = blen + sizeof(b0) + sizeof(b1) + zero_padding;
dst_buf = kzalloc(dst_size, GFP_KERNEL);
-   if (dst_buf == NULL) {
-   printk(KERN_ERR "E: can't alloc destination buffer\n");
+   if (!dst_buf)
goto error_dst_buf;
-   }
 
memset(iv, 0, sizeof(iv));
 
-- 
2.9.3

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


[PATCH 32/44] usb: misc: uss720: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/uss720.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index 256d02da444d0f..356d312add5779 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -150,10 +150,8 @@ static struct uss720_async_request 
*submit_async_request(struct parport_uss720_p
if (!usbdev)
return NULL;
rq = kzalloc(sizeof(struct uss720_async_request), mem_flags);
-   if (!rq) {
-   dev_err(&usbdev->dev, "submit_async_request out of memory\n");
+   if (!rq)
return NULL;
-   }
kref_init(&rq->ref_count);
INIT_LIST_HEAD(&rq->asynclist);
init_completion(&rq->compl);
-- 
2.9.3

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


[PATCH 09/44] usb: core: urb: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/core/urb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index c601e25b609fb5..a9039696476e68 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -68,10 +68,8 @@ struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags)
urb = kmalloc(sizeof(struct urb) +
iso_packets * sizeof(struct usb_iso_packet_descriptor),
mem_flags);
-   if (!urb) {
-   printk(KERN_ERR "alloc_urb: kmalloc failed\n");
+   if (!urb)
return NULL;
-   }
usb_init_urb(urb);
return urb;
 }
-- 
2.9.3

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


[PATCH 14/44] usb: host: fhci-hcd: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/host/fhci-hcd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 0960f41f945aba..55a0ae6f2d7430 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -310,10 +310,8 @@ static struct fhci_usb *fhci_create_lld(struct fhci_hcd 
*fhci)
 
/* allocate memory for SCC data structure */
usb = kzalloc(sizeof(*usb), GFP_KERNEL);
-   if (!usb) {
-   fhci_err(fhci, "no memory for SCC data struct\n");
+   if (!usb)
return NULL;
-   }
 
usb->fhci = fhci;
usb->hc_list = fhci->hc_list;
-- 
2.9.3

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


[PATCH 37/44] usb: renesas_usbhs: mod_host: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/renesas_usbhs/mod_host.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/mod_host.c 
b/drivers/usb/renesas_usbhs/mod_host.c
index 3bf0b72eb359f1..165e81bfd93a66 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -166,14 +166,10 @@ static struct usbhsh_request *usbhsh_ureq_alloc(struct 
usbhsh_hpriv *hpriv,
   gfp_t mem_flags)
 {
struct usbhsh_request *ureq;
-   struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
-   struct device *dev = usbhs_priv_to_dev(priv);
 
ureq = kzalloc(sizeof(struct usbhsh_request), mem_flags);
-   if (!ureq) {
-   dev_err(dev, "ureq alloc fail\n");
+   if (!ureq)
return NULL;
-   }
 
usbhs_pkt_init(&ureq->pkt);
ureq->urb = urb;
@@ -388,10 +384,8 @@ static int usbhsh_endpoint_attach(struct usbhsh_hpriv 
*hpriv,
unsigned long flags;
 
uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags);
-   if (!uep) {
-   dev_err(dev, "usbhsh_ep alloc fail\n");
+   if (!uep)
return -ENOMEM;
-   }
 
/  spin lock /
usbhs_lock(priv, flags);
-- 
2.9.3

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


[PATCH 24/44] usb: misc: idmouse: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/idmouse.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index 5105397e62fc76..2975e80b7a56f9 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -366,7 +366,6 @@ static int idmouse_probe(struct usb_interface *interface,
kmalloc(IMGSIZE + dev->bulk_in_size, GFP_KERNEL);
 
if (!dev->bulk_in_buffer) {
-   dev_err(&interface->dev, "Unable to allocate input 
buffer.\n");
idmouse_delete(dev);
return -ENOMEM;
}
-- 
2.9.3

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


[PATCH 22/44] usb: misc: cytherm: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/cytherm.c | 32 
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 9bab1a33bc16b6..9d8bb8dacdcd11 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -101,10 +101,8 @@ static ssize_t set_brightness(struct device *dev, struct 
device_attribute *attr,
int retval;

buffer = kmalloc(8, GFP_KERNEL);
-   if (!buffer) {
-   dev_err(&cytherm->udev->dev, "out of memory\n");
+   if (!buffer)
return 0;
-   }
 
cytherm->brightness = simple_strtoul(buf, NULL, 10);

@@ -148,10 +146,8 @@ static ssize_t show_temp(struct device *dev, struct 
device_attribute *attr, char
int temp, sign;

buffer = kmalloc(8, GFP_KERNEL);
-   if (!buffer) {
-   dev_err(&cytherm->udev->dev, "out of memory\n");
+   if (!buffer)
return 0;
-   }
 
/* read temperature */
retval = vendor_command(cytherm->udev, READ_RAM, TEMP, 0, buffer, 8);
@@ -192,10 +188,8 @@ static ssize_t show_button(struct device *dev, struct 
device_attribute *attr, ch
unsigned char *buffer;
 
buffer = kmalloc(8, GFP_KERNEL);
-   if (!buffer) {
-   dev_err(&cytherm->udev->dev, "out of memory\n");
+   if (!buffer)
return 0;
-   }
 
/* check button */
retval = vendor_command(cytherm->udev, READ_RAM, BUTTON, 0, buffer, 8);
@@ -230,10 +224,8 @@ static ssize_t show_port0(struct device *dev, struct 
device_attribute *attr, cha
unsigned char *buffer;
 
buffer = kmalloc(8, GFP_KERNEL);
-   if (!buffer) {
-   dev_err(&cytherm->udev->dev, "out of memory\n");
+   if (!buffer)
return 0;
-   }
 
retval = vendor_command(cytherm->udev, READ_PORT, 0, 0, buffer, 8);
if (retval)
@@ -257,10 +249,8 @@ static ssize_t set_port0(struct device *dev, struct 
device_attribute *attr, cons
int tmp;

buffer = kmalloc(8, GFP_KERNEL);
-   if (!buffer) {
-   dev_err(&cytherm->udev->dev, "out of memory\n");
+   if (!buffer)
return 0;
-   }
 
tmp = simple_strtoul(buf, NULL, 10);

@@ -290,10 +280,8 @@ static ssize_t show_port1(struct device *dev, struct 
device_attribute *attr, cha
unsigned char *buffer;
 
buffer = kmalloc(8, GFP_KERNEL);
-   if (!buffer) {
-   dev_err(&cytherm->udev->dev, "out of memory\n");
+   if (!buffer)
return 0;
-   }
 
retval = vendor_command(cytherm->udev, READ_PORT, 1, 0, buffer, 8);
if (retval)
@@ -317,10 +305,8 @@ static ssize_t set_port1(struct device *dev, struct 
device_attribute *attr, cons
int tmp;

buffer = kmalloc(8, GFP_KERNEL);
-   if (!buffer) {
-   dev_err(&cytherm->udev->dev, "out of memory\n");
+   if (!buffer)
return 0;
-   }
 
tmp = simple_strtoul(buf, NULL, 10);

@@ -351,10 +337,8 @@ static int cytherm_probe(struct usb_interface *interface,
int retval = -ENOMEM;
 
dev = kzalloc (sizeof(struct usb_cytherm), GFP_KERNEL);
-   if (dev == NULL) {
-   dev_err (&interface->dev, "Out of memory\n");
+   if (!dev)
goto error_mem;
-   }
 
dev->udev = usb_get_dev(udev);
 
-- 
2.9.3

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


[PATCH 17/44] usb: host: xhci-tegra: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/host/xhci-tegra.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 0f53ae0f464e6d..d39b37be71f01f 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -1033,7 +1033,6 @@ static int tegra_xusb_probe(struct platform_device *pdev)
tegra->phys = devm_kcalloc(&pdev->dev, tegra->num_phys,
   sizeof(*tegra->phys), GFP_KERNEL);
if (!tegra->phys) {
-   dev_err(&pdev->dev, "failed to allocate PHY array\n");
err = -ENOMEM;
goto put_padctl;
}
-- 
2.9.3

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


[PATCH 00/44] usb: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
Here is my next series to save memory by removing unneeded strings. It removes
in the usb subsystem all unspecific error messages after calling malloc-based
functions, i.e. (devm_)k[zcm]alloc. kmalloc prints enough information in that
case. If the message was specific (e.g. "can't save CLEAR_TT_BUFFER state"), I
left it. This series saves ~4.5KB of "out of memory" permutations in .text and
.rodata. For modified lines, (x == NULL) was replaced with (!NULL) as well.
This seems to be the dominant style in this subsystem and checkpatch recommends
it as well (and I prefer it, too).

Wolfram Sang (44):
  usb: atm: cxacru: don't print on ENOMEM
  usb: atm: speedtch: don't print on ENOMEM
  usb: atm: ueagle-atm: don't print on ENOMEM
  usb: atm: usbatm: don't print on ENOMEM
  usb: class: usbtmc: don't print on ENOMEM
  usb: core: hcd: don't print on ENOMEM
  usb: core: hub: don't print on ENOMEM
  usb: core: message: don't print on ENOMEM
  usb: core: urb: don't print on ENOMEM
  usb: dwc2: gadget: don't print on ENOMEM
  usb: gadget: udc: fsl_qe_udc: don't print on ENOMEM
  usb: gadget: udc: goku_udc: don't print on ENOMEM
  usb: gadget: udc: udc-xilinx: don't print on ENOMEM
  usb: host: fhci-hcd: don't print on ENOMEM
  usb: host: max3421-hcd: don't print on ENOMEM
  usb: host: uhci-hcd: don't print on ENOMEM
  usb: host: xhci-tegra: don't print on ENOMEM
  usb: host: xhci: don't print on ENOMEM
  usb: misc: adutux: don't print on ENOMEM
  usb: misc: appledisplay: don't print on ENOMEM
  usb: misc: cypress_cy7c63: don't print on ENOMEM
  usb: misc: cytherm: don't print on ENOMEM
  usb: misc: ftdi-elan: don't print on ENOMEM
  usb: misc: idmouse: don't print on ENOMEM
  usb: misc: iowarrior: don't print on ENOMEM
  usb: misc: ldusb: don't print on ENOMEM
  usb: misc: legousbtower: don't print on ENOMEM
  usb: misc: lvstest: don't print on ENOMEM
  usb: misc: trancevibrator: don't print on ENOMEM
  usb: misc: usblcd: don't print on ENOMEM
  usb: misc: usbsevseg: don't print on ENOMEM
  usb: misc: uss720: don't print on ENOMEM
  usb: misc: yurex: don't print on ENOMEM
  usb: musb: am35x: don't print on ENOMEM
  usb: musb: da8xx: don't print on ENOMEM
  usb: renesas_usbhs: mod_gadget: don't print on ENOMEM
  usb: renesas_usbhs: mod_host: don't print on ENOMEM
  usb: renesas_usbhs: pipe: don't print on ENOMEM
  usb: storage: alauda: don't print on ENOMEM
  usb: storage: sddr09: don't print on ENOMEM
  usb: usb-skeleton: don't print on ENOMEM
  usb: wusbcore: crypto: don't print on ENOMEM
  usb: wusbcore: security: don't print on ENOMEM
  usb: wusbcore: wa-nep: don't print on ENOMEM

 drivers/usb/atm/cxacru.c   |  4 +---
 drivers/usb/atm/speedtch.c |  1 -
 drivers/usb/atm/ueagle-atm.c   |  9 ++---
 drivers/usb/atm/usbatm.c   |  7 +--
 drivers/usb/class/usbtmc.c |  4 +---
 drivers/usb/core/hcd.c |  4 +---
 drivers/usb/core/hub.c |  9 +++--
 drivers/usb/core/message.c |  5 +
 drivers/usb/core/urb.c |  4 +---
 drivers/usb/dwc2/gadget.c  |  8 ++--
 drivers/usb/gadget/udc/fsl_qe_udc.c| 16 
 drivers/usb/gadget/udc/goku_udc.c  |  3 +--
 drivers/usb/gadget/udc/udc-xilinx.c|  4 +---
 drivers/usb/host/fhci-hcd.c|  4 +---
 drivers/usb/host/max3421-hcd.c |  8 ++--
 drivers/usb/host/uhci-hcd.c|  5 +
 drivers/usb/host/xhci-tegra.c  |  1 -
 drivers/usb/host/xhci.c|  4 +---
 drivers/usb/misc/adutux.c  | 13 +++--
 drivers/usb/misc/appledisplay.c|  3 ---
 drivers/usb/misc/cypress_cy7c63.c  |  5 +
 drivers/usb/misc/cytherm.c | 32 
 drivers/usb/misc/ftdi-elan.c   |  1 -
 drivers/usb/misc/idmouse.c |  1 -
 drivers/usb/misc/iowarrior.c   | 20 ++--
 drivers/usb/misc/ldusb.c   | 20 +---
 drivers/usb/misc/legousbtower.c| 16 
 drivers/usb/misc/lvstest.c |  4 +---
 drivers/usb/misc/trancevibrator.c  |  3 +--
 drivers/usb/misc/usblcd.c  |  9 ++---
 drivers/usb/misc/usbsevseg.c   |  8 ++--
 drivers/usb/misc/uss720.c  |  4 +---
 drivers/usb/misc/yurex.c   |  8 ++--
 drivers/usb/musb/am35x.c   |  4 +---
 drivers/usb/musb/da8xx.c   |  4 +---
 drivers/usb/renesas_usbhs/mod_gadget.c |  6 +-
 drivers/usb/renesas_usbhs/mod_host.c   | 10 ++
 drivers/usb/renesas_usbhs/pipe.c   |  4 +---
 drivers/usb/storage/alauda.c   | 11 +++
 drivers/usb/storage/sddr09.c   | 

[PATCH 16/44] usb: host: uhci-hcd: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/host/uhci-hcd.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index a7de8e8bb4582b..5d3d914ab4fb44 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -601,11 +601,8 @@ static int uhci_start(struct usb_hcd *hcd)
 
uhci->frame_cpu = kcalloc(UHCI_NUMFRAMES, sizeof(*uhci->frame_cpu),
GFP_KERNEL);
-   if (!uhci->frame_cpu) {
-   dev_err(uhci_dev(uhci),
-   "unable to allocate memory for frame pointers\n");
+   if (!uhci->frame_cpu)
goto err_alloc_frame_cpu;
-   }
 
uhci->td_pool = dma_pool_create("uhci_td", uhci_dev(uhci),
sizeof(struct uhci_td), 16, 0);
-- 
2.9.3

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


[PATCH 40/44] usb: storage: sddr09: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/storage/sddr09.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index c5797fa2125e94..3aeaa536c44f9e 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -766,10 +766,8 @@ sddr09_read_data(struct us_data *us,
 
len = min(sectors, (unsigned int) info->blocksize) * info->pagesize;
buffer = kmalloc(len, GFP_NOIO);
-   if (buffer == NULL) {
-   printk(KERN_WARNING "sddr09_read_data: Out of memory\n");
+   if (!buffer)
return -ENOMEM;
-   }
 
// This could be made much more efficient by checking for
// contiguous LBA's. Another exercise left to the student.
@@ -1004,10 +1002,8 @@ sddr09_write_data(struct us_data *us,
pagelen = (1 << info->pageshift) + (1 << CONTROL_SHIFT);
blocklen = (pagelen << info->blockshift);
blockbuffer = kmalloc(blocklen, GFP_NOIO);
-   if (!blockbuffer) {
-   printk(KERN_WARNING "sddr09_write_data: Out of memory\n");
+   if (!blockbuffer)
return -ENOMEM;
-   }
 
/*
 * Since we don't write the user data directly to the device,
@@ -1017,8 +1013,7 @@ sddr09_write_data(struct us_data *us,
 
len = min(sectors, (unsigned int) info->blocksize) * info->pagesize;
buffer = kmalloc(len, GFP_NOIO);
-   if (buffer == NULL) {
-   printk(KERN_WARNING "sddr09_write_data: Out of memory\n");
+   if (!buffer) {
kfree(blockbuffer);
return -ENOMEM;
}
@@ -1241,8 +1236,7 @@ sddr09_read_map(struct us_data *us) {
alloc_blocks = min(numblocks, SDDR09_READ_MAP_BUFSZ >> CONTROL_SHIFT);
alloc_len = (alloc_blocks << CONTROL_SHIFT);
buffer = kmalloc(alloc_len, GFP_NOIO);
-   if (buffer == NULL) {
-   printk(KERN_WARNING "sddr09_read_map: out of memory\n");
+   if (!buffer) {
result = -1;
goto done;
}
-- 
2.9.3

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


[PATCH 28/44] usb: misc: lvstest: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/misc/lvstest.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
index 961faae62ea087..af2952b918b843 100644
--- a/drivers/usb/misc/lvstest.c
+++ b/drivers/usb/misc/lvstest.c
@@ -247,10 +247,8 @@ static ssize_t get_dev_desc_store(struct device *dev,
int ret;
 
descriptor = kmalloc(sizeof(*descriptor), GFP_KERNEL);
-   if (!descriptor) {
-   dev_err(dev, "failed to allocate descriptor memory\n");
+   if (!descriptor)
return -ENOMEM;
-   }
 
udev = create_lvs_device(intf);
if (!udev) {
-- 
2.9.3

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


[PATCH 34/44] usb: musb: am35x: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/musb/am35x.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index c41fe588d14d97..c14577dbedf71a 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -474,10 +474,8 @@ static int am35x_probe(struct platform_device *pdev)
int ret = -ENOMEM;
 
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
-   if (!glue) {
-   dev_err(&pdev->dev, "failed to allocate glue context\n");
+   if (!glue)
goto err0;
-   }
 
phy_clk = clk_get(&pdev->dev, "fck");
if (IS_ERR(phy_clk)) {
-- 
2.9.3

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


[PATCH 44/44] usb: wusbcore: wa-nep: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/wusbcore/wa-nep.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/wusbcore/wa-nep.c b/drivers/usb/wusbcore/wa-nep.c
index 6140100ad50e41..ed4622279c63c0 100644
--- a/drivers/usb/wusbcore/wa-nep.c
+++ b/drivers/usb/wusbcore/wa-nep.c
@@ -271,11 +271,8 @@ int wa_nep_create(struct wahc *wa, struct usb_interface 
*iface)
epd = &iface->cur_altsetting->endpoint[0].desc;
wa->nep_buffer_size = 1024;
wa->nep_buffer = kmalloc(wa->nep_buffer_size, GFP_KERNEL);
-   if (wa->nep_buffer == NULL) {
-   dev_err(dev,
-   "Unable to allocate notification's read buffer\n");
+   if (!wa->nep_buffer)
goto error_nep_buffer;
-   }
wa->nep_urb = usb_alloc_urb(0, GFP_KERNEL);
if (wa->nep_urb == NULL)
goto error_urb_alloc;
-- 
2.9.3

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


[PATCH 12/44] usb: gadget: udc: goku_udc: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/gadget/udc/goku_udc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/goku_udc.c 
b/drivers/usb/gadget/udc/goku_udc.c
index d2205d9e0c8b43..1400415fe67ac8 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -1767,8 +1767,7 @@ static int goku_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
 
/* alloc, and start init */
dev = kzalloc (sizeof *dev, GFP_KERNEL);
-   if (dev == NULL){
-   pr_debug("enomem %s\n", pci_name(pdev));
+   if (!dev) {
retval = -ENOMEM;
goto err;
}
-- 
2.9.3

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


[PATCH 01/44] usb: atm: cxacru: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/atm/cxacru.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 18b281d73a39ee..f9fe86b6f7b5b6 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -1139,10 +1139,8 @@ static int cxacru_bind(struct usbatm_data 
*usbatm_instance,
 
/* instance init */
instance = kzalloc(sizeof(*instance), GFP_KERNEL);
-   if (!instance) {
-   usb_dbg(usbatm_instance, "cxacru_bind: no memory for instance 
data\n");
+   if (!instance)
return -ENOMEM;
-   }
 
instance->usbatm = usbatm_instance;
instance->modem_type = (struct cxacru_modem_type *) id->driver_info;
-- 
2.9.3

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


[PATCH 04/44] usb: atm: usbatm: don't print on ENOMEM

2016-08-25 Thread Wolfram Sang
All kmalloc-based functions print enough information on failures.

Signed-off-by: Wolfram Sang 
---
 drivers/usb/atm/usbatm.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 5e4f46c5a30046..4dec9df8764b9a 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -819,7 +819,6 @@ static int usbatm_atm_open(struct atm_vcc *vcc)
 
new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL);
if (!new) {
-   atm_err(instance, "%s: no memory for vcc_data!\n", __func__);
ret = -ENOMEM;
goto fail;
}
@@ -1032,10 +1031,8 @@ int usbatm_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *id,
 
/* instance init */
instance = kzalloc(sizeof(*instance) + sizeof(struct urb *) * 
(num_rcv_urbs + num_snd_urbs), GFP_KERNEL);
-   if (!instance) {
-   dev_err(dev, "%s: no memory for instance data!\n", __func__);
+   if (!instance)
return -ENOMEM;
-   }
 
/* public fields */
 
@@ -1150,7 +1147,6 @@ int usbatm_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *id,
/* zero the tx padding to avoid leaking information */
buffer = kzalloc(channel->buf_size, GFP_KERNEL);
if (!buffer) {
-   dev_err(dev, "%s: no memory for buffer %d!\n", 
__func__, i);
error = -ENOMEM;
goto fail_unbind;
}
@@ -1181,7 +1177,6 @@ int usbatm_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *id,
instance->cell_buf = kmalloc(instance->rx_channel.stride, GFP_KERNEL);
 
if (!instance->cell_buf) {
-   dev_err(dev, "%s: no memory for cell buffer!\n", __func__);
error = -ENOMEM;
goto fail_unbind;
}
-- 
2.9.3

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


[PATCH 2/6] staging: media: lirc: lirc_imon: don't print error when allocating urb fails

2016-08-11 Thread Wolfram Sang
kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/media/lirc/lirc_imon.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_imon.c 
b/drivers/staging/media/lirc/lirc_imon.c
index ff1926ca1f96f5..a183e68ec32089 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -797,16 +797,11 @@ static int imon_probe(struct usb_interface *interface,
goto free_rbuf;
}
rx_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!rx_urb) {
-   dev_err(dev, "%s: usb_alloc_urb failed for IR urb\n", __func__);
+   if (!rx_urb)
goto free_lirc_buf;
-   }
tx_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!tx_urb) {
-   dev_err(dev, "%s: usb_alloc_urb failed for display urb\n",
-   __func__);
+   if (!tx_urb)
goto free_rx_urb;
-   }
 
mutex_init(&context->ctx_lock);
context->vfd_proto_6p = vfd_proto_6p;
-- 
2.8.1

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


[PATCH 0/6] staging: don't print error when allocating urb fails

2016-08-11 Thread Wolfram Sang
This per-subsystem series is part of a tree wide cleanup. usb_alloc_urb() uses
kmalloc which already prints enough information on failure. So, let's simply
remove those "allocation failed" messages from drivers like we did already for
other -ENOMEM cases. gkh acked this approach when we talked about it at LCJ in
Tokyo a few weeks ago.


Wolfram Sang (6):
  staging: comedi: drivers: usbduxfast: don't print error when
allocating urb fails
  staging: media: lirc: lirc_imon: don't print error when allocating urb
fails
  staging: media: lirc: lirc_sasem: don't print error when allocating
urb fails
  staging: most: hdm-usb: hdm_usb: don't print error when allocating urb
fails
  staging: rtl8192u: r8192U_core: don't print error when allocating urb
fails
  staging: vt6656: main_usb: don't print error when allocating urb fails

 drivers/staging/comedi/drivers/usbduxfast.c |  4 +---
 drivers/staging/media/lirc/lirc_imon.c  |  9 ++---
 drivers/staging/media/lirc/lirc_sasem.c |  5 -
 drivers/staging/most/hdm-usb/hdm_usb.c  |  4 +---
 drivers/staging/rtl8192u/r8192U_core.c  |  5 +
 drivers/staging/vt6656/main_usb.c   | 12 +++-
 6 files changed, 8 insertions(+), 31 deletions(-)

-- 
2.8.1

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


[PATCH 1/6] staging: comedi: drivers: usbduxfast: don't print error when allocating urb fails

2016-08-11 Thread Wolfram Sang
kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/comedi/drivers/usbduxfast.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 10f94ec3453606..608403c7586b76 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -946,10 +946,8 @@ static int usbduxfast_auto_attach(struct comedi_device 
*dev,
}
 
devpriv->urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!devpriv->urb) {
-   dev_err(dev->class_dev, "Could not alloc. urb\n");
+   if (!devpriv->urb)
return -ENOMEM;
-   }
 
devpriv->inbuf = kmalloc(SIZEINBUF, GFP_KERNEL);
if (!devpriv->inbuf)
-- 
2.8.1

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


[PATCH 5/6] staging: rtl8192u: r8192U_core: don't print error when allocating urb fails

2016-08-11 Thread Wolfram Sang
kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/rtl8192u/r8192U_core.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index dd0970facdf5bd..7af1af8c6616f4 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1702,11 +1702,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff 
*skb)
}
if (bSend0Byte) {
tx_urb_zero = usb_alloc_urb(0, GFP_ATOMIC);
-   if (!tx_urb_zero) {
-   RT_TRACE(COMP_ERR,
-"can't alloc urb for zero byte\n");
+   if (!tx_urb_zero)
return -ENOMEM;
-   }
usb_fill_bulk_urb(tx_urb_zero, udev,
  usb_sndbulkpipe(udev, idx_pipe),
  &zero, 0, tx_zero_isr, dev);
-- 
2.8.1

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


[PATCH 4/6] staging: most: hdm-usb: hdm_usb: don't print error when allocating urb fails

2016-08-11 Thread Wolfram Sang
kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/most/hdm-usb/hdm_usb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index aeae071f282321..9ec29788c0471f 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -650,10 +650,8 @@ static int hdm_enqueue(struct most_interface *iface, int 
channel,
return -ENODEV;
 
urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_ATOMIC);
-   if (!urb) {
-   dev_err(dev, "Failed to allocate URB\n");
+   if (!urb)
return -ENOMEM;
-   }
 
anchor = kzalloc(sizeof(*anchor), GFP_ATOMIC);
if (!anchor) {
-- 
2.8.1

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


  1   2   3   >