Re: [PATCH] isdn/gigaset: check endpoint null in gigaset_probe

2019-07-26 Thread Phong Tran

On 7/26/19 9:22 PM, Paul Bolle wrote:

Phong Tran schreef op vr 26-07-2019 om 20:35 [+0700]:

This fixed the potential reference NULL pointer while using variable
endpoint.

Reported-by: syzbot+35b1c403a14f5c89e...@syzkaller.appspotmail.com
Tested by syzbot:
https://groups.google.com/d/msg/syzkaller-bugs/wnHG8eRNWEA/Qn2HhjNdBgAJ

Signed-off-by: Phong Tran 
---
  drivers/isdn/gigaset/usb-gigaset.c | 9 +


This is now drivers/staging/isdn/gigaset/usb-gigaset.c.


this patch was created base on branch 
kasan/usb-fuzzer-usb-testing-2019.07.11 [1]

I did not notice about the driver was moved to staging.




  1 file changed, 9 insertions(+)

diff --git a/drivers/isdn/gigaset/usb-gigaset.c 
b/drivers/isdn/gigaset/usb-gigaset.c
index 1b9b43659bdf..2e011f3db59e 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -703,6 +703,10 @@ static int gigaset_probe(struct usb_interface *interface,
usb_set_intfdata(interface, cs);
  
  	endpoint = >endpoint[0].desc;

+if (!endpoint) {
+   dev_err(cs->dev, "Couldn't get control endpoint\n");
+   return -ENODEV;
+   }


When can this happen? Is this one of those bugs that one can only trigger with
a specially crafted (evil) usb device?



Yes, in my understanding, this only happens with random test of syzbot.


buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
ucs->bulk_out_size = buffer_size;
@@ -722,6 +726,11 @@ static int gigaset_probe(struct usb_interface *interface,
}
  
  	endpoint = >endpoint[1].desc;

+if (!endpoint) {
+   dev_err(cs->dev, "Endpoint not available\n");
+   retval = -ENODEV;
+   goto error;
+   }
  
  	ucs->busy = 0;
  


Please note that I'm very close to getting cut off from the ISDN network, so
the chances of being able to testi this on a live system are getting small.



This bug can be invalid now. Do you agree?
There is an instruction to report invalid bug to syzbot [2].


Thanks,


Paul Bolle




[1] 
https://github.com/google/kasan/commits/usb-fuzzer-usb-testing-2019.07.11
[2] 
https://github.com/google/syzkaller/blob/master/docs/syzbot.md#communication-with-syzbot


Thanks,
Phong


[PATCH] isdn/gigaset: check endpoint null in gigaset_probe

2019-07-26 Thread Phong Tran
This fixed the potential reference NULL pointer while using variable
endpoint.

Reported-by: syzbot+35b1c403a14f5c89e...@syzkaller.appspotmail.com
Tested by syzbot:
https://groups.google.com/d/msg/syzkaller-bugs/wnHG8eRNWEA/Qn2HhjNdBgAJ

Signed-off-by: Phong Tran 
---
 drivers/isdn/gigaset/usb-gigaset.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/isdn/gigaset/usb-gigaset.c 
b/drivers/isdn/gigaset/usb-gigaset.c
index 1b9b43659bdf..2e011f3db59e 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -703,6 +703,10 @@ static int gigaset_probe(struct usb_interface *interface,
usb_set_intfdata(interface, cs);
 
endpoint = >endpoint[0].desc;
+if (!endpoint) {
+   dev_err(cs->dev, "Couldn't get control endpoint\n");
+   return -ENODEV;
+   }
 
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
ucs->bulk_out_size = buffer_size;
@@ -722,6 +726,11 @@ static int gigaset_probe(struct usb_interface *interface,
}
 
endpoint = >endpoint[1].desc;
+if (!endpoint) {
+   dev_err(cs->dev, "Endpoint not available\n");
+   retval = -ENODEV;
+   goto error;
+   }
 
ucs->busy = 0;
 
-- 
2.20.1



Re: [PATCH 5.1 00/96] 5.1.17-stable review

2019-07-08 Thread Phong Tran

On 7/8/19 10:12 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 5.1.17 release.
There are 96 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Wed 10 Jul 2019 03:03:52 PM UTC.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:

https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.1.17-rc1.gz
or in the git tree and branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
linux-5.1.y
and the diffstat can be found below.



build and boot fine with qemu-system-riscv64

root@(none):~# uname  -a
Linux (none) 5.1.17-rc1-00097-gb64119f8dffe #4 SMP Tue Jul 9 00:44:23 
+07 2019 riscv64 GNU/Linux

root@(none):~# cat /proc/cpuinfo
processor   : 0
hart: 0
isa : rv64imafdcu
mmu : sv48




Re: [PATCH 4.19 00/90] 4.19.58-stable review

2019-07-08 Thread Phong Tran

Hi Greg,

On 7/8/19 10:12 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 4.19.58 release.
There are 90 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Wed 10 Jul 2019 03:03:52 PM UTC.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:

https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.58-rc1.gz



compile and boot fine with  qemu-system-riscv64 -nographic -machine virt 
 -kernel riscv-pk/build/bbl -append "root=/dev/vda ro 
console=/dev/ttyS0"  -drive 
file=busybear-linux/busybear.bin,format=raw,id=hd0  -device 
virtio-blk-device,drive=hd0



root@(none):~# uname -a
Linux (none) 4.19.58-rc1-00091-gc4064b656955 #3 SMP Tue Jul 9 00:25:27 
+07 2019 riscv64 GNU/Linux

root@(none):~# cat /proc/cpuinfo
hart: 0
isa : rv64imafdcsu
mmu : sv48

Regards,
Phong.


[PATCH V2] media: usb: technisat-usb2: fix buffer overflow

2019-07-02 Thread Phong Tran
The buffer will be overflow in case of the while loop can not break.
Add the checking buffer condition in while loop for avoiding
overlooping index.

This issue was reported by syzbot

Reported-by: syzbot+eaaaf38a95427be88...@syzkaller.appspotmail.com

Tested-by:
https://groups.google.com/d/msg/syzkaller-bugs/CySBCKuUOOs/t3PvVheSAAAJ

Signed-off-by: Phong Tran 
---
Change Log:
 * V2: add IR_MAX_BUFFER_INDEX and adjust the while loop condition as comments
---
 drivers/media/usb/dvb-usb/technisat-usb2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c 
b/drivers/media/usb/dvb-usb/technisat-usb2.c
index c659e18b358b..cdabff97c1ea 100644
--- a/drivers/media/usb/dvb-usb/technisat-usb2.c
+++ b/drivers/media/usb/dvb-usb/technisat-usb2.c
@@ -49,6 +49,7 @@ MODULE_PARM_DESC(disable_led_control,
"disable LED control of the device (default: 0 - LED control is 
active).");
 
 /* device private data */
+#define IR_MAX_BUFFER_INDEX63
 struct technisat_usb2_state {
struct dvb_usb_device *dev;
struct delayed_work green_led_work;
@@ -56,7 +57,7 @@ struct technisat_usb2_state {
 
u16 last_scan_code;
 
-   u8 buf[64];
+   u8 buf[IR_MAX_BUFFER_INDEX + 1];
 };
 
 /* debug print helpers */
@@ -655,7 +656,7 @@ static int technisat_usb2_get_ir(struct dvb_usb_device *d)
 #endif
 
ev.pulse = 0;
-   while (1) {
+   while (b <= (buf + IR_MAX_BUFFER_INDEX)) {
ev.pulse = !ev.pulse;
ev.duration = (*b * FIRMWARE_CLOCK_DIVISOR * 
FIRMWARE_CLOCK_TICK) / 1000;
ir_raw_event_store(d->rc_dev, );
-- 
2.11.0



[PATCH] media: usb: technisat-usb2: fix buffer overflow

2019-07-02 Thread Phong Tran
The buffer will be overflow in case of the while loop can not break.
Add the checking buffer condition in while loop for avoiding
overlooping index.

This issue was reported by syzbot

Reported-by: syzbot+eaaaf38a95427be88...@syzkaller.appspotmail.com

Tested by:
https://groups.google.com/d/msg/syzkaller-bugs/CySBCKuUOOs/0hKq1CdjCwAJ

Signed-off-by: Phong Tran 
---
 drivers/media/usb/dvb-usb/technisat-usb2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c 
b/drivers/media/usb/dvb-usb/technisat-usb2.c
index c659e18b358b..4e0b6185666a 100644
--- a/drivers/media/usb/dvb-usb/technisat-usb2.c
+++ b/drivers/media/usb/dvb-usb/technisat-usb2.c
@@ -655,7 +655,7 @@ static int technisat_usb2_get_ir(struct dvb_usb_device *d)
 #endif
 
ev.pulse = 0;
-   while (1) {
+   while (b != (buf + 63)) {
ev.pulse = !ev.pulse;
ev.duration = (*b * FIRMWARE_CLOCK_DIVISOR * 
FIRMWARE_CLOCK_TICK) / 1000;
ir_raw_event_store(d->rc_dev, );
-- 
2.11.0



[PATCH V2] net: usb: asix: init MAC address buffers

2019-07-01 Thread Phong Tran
This is for fixing bug KMSAN: uninit-value in ax88772_bind

Tested by
https://groups.google.com/d/msg/syzkaller-bugs/aFQurGotng4/eB_HlNhhCwAJ

Reported-by: syzbot+8a3fc6674bbc3978e...@syzkaller.appspotmail.com

syzbot found the following crash on:

HEAD commit:f75e4cfe kmsan: use kmsan_handle_urb() in urb.c
git tree:   kmsan
console output: https://syzkaller.appspot.com/x/log.txt?x=136d720ea0
kernel config:
https://syzkaller.appspot.com/x/.config?x=602468164ccdc30a
dashboard link:
https://syzkaller.appspot.com/bug?extid=8a3fc6674bbc3978ed4e
compiler:   clang version 9.0.0 (/home/glider/llvm/clang
06d00afa61eef8f7f501ebdb4e8612ea43ec2d78)
syz repro:
https://syzkaller.appspot.com/x/repro.syz?x=12788316a0
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=120359aaa0

==
BUG: KMSAN: uninit-value in is_valid_ether_addr
include/linux/etherdevice.h:200 [inline]
BUG: KMSAN: uninit-value in asix_set_netdev_dev_addr
drivers/net/usb/asix_devices.c:73 [inline]
BUG: KMSAN: uninit-value in ax88772_bind+0x93d/0x11e0
drivers/net/usb/asix_devices.c:724
CPU: 0 PID: 3348 Comm: kworker/0:2 Not tainted 5.1.0+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x191/0x1f0 lib/dump_stack.c:113
  kmsan_report+0x130/0x2a0 mm/kmsan/kmsan.c:622
  __msan_warning+0x75/0xe0 mm/kmsan/kmsan_instr.c:310
  is_valid_ether_addr include/linux/etherdevice.h:200 [inline]
  asix_set_netdev_dev_addr drivers/net/usb/asix_devices.c:73 [inline]
  ax88772_bind+0x93d/0x11e0 drivers/net/usb/asix_devices.c:724
  usbnet_probe+0x10f5/0x3940 drivers/net/usb/usbnet.c:1728
  usb_probe_interface+0xd66/0x1320 drivers/usb/core/driver.c:361
  really_probe+0xdae/0x1d80 drivers/base/dd.c:513
  driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671
  __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778
  bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454
  __device_attach+0x454/0x730 drivers/base/dd.c:844
  device_initial_probe+0x4a/0x60 drivers/base/dd.c:891
  bus_probe_device+0x137/0x390 drivers/base/bus.c:514
  device_add+0x288d/0x30e0 drivers/base/core.c:2106
  usb_set_configuration+0x30dc/0x3750 drivers/usb/core/message.c:2027
  generic_probe+0xe7/0x280 drivers/usb/core/generic.c:210
  usb_probe_device+0x14c/0x200 drivers/usb/core/driver.c:266
  really_probe+0xdae/0x1d80 drivers/base/dd.c:513
  driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671
  __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778
  bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454
  __device_attach+0x454/0x730 drivers/base/dd.c:844
  device_initial_probe+0x4a/0x60 drivers/base/dd.c:891
  bus_probe_device+0x137/0x390 drivers/base/bus.c:514
  device_add+0x288d/0x30e0 drivers/base/core.c:2106
  usb_new_device+0x23e5/0x2ff0 drivers/usb/core/hub.c:2534
  hub_port_connect drivers/usb/core/hub.c:5089 [inline]
  hub_port_connect_change drivers/usb/core/hub.c:5204 [inline]
  port_event drivers/usb/core/hub.c:5350 [inline]
  hub_event+0x48d1/0x7290 drivers/usb/core/hub.c:5432
  process_one_work+0x1572/0x1f00 kernel/workqueue.c:2269
  process_scheduled_works kernel/workqueue.c:2331 [inline]
  worker_thread+0x189c/0x2460 kernel/workqueue.c:2417
  kthread+0x4b5/0x4f0 kernel/kthread.c:254
  ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355

Signed-off-by: Phong Tran 
---
Changes since v1:
- replace memset() by array init
---
 drivers/net/usb/asix_devices.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index c9bc96310ed4..ef548beba684 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -226,7 +226,7 @@ static void asix_phy_reset(struct usbnet *dev, unsigned int 
reset_bits)
 static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
 {
int ret = 0;
-   u8 buf[ETH_ALEN];
+   u8 buf[ETH_ALEN] = {0};
int i;
unsigned long gpio_bits = dev->driver_info->data;
 
@@ -677,7 +677,7 @@ static int asix_resume(struct usb_interface *intf)
 static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 {
int ret, i;
-   u8 buf[ETH_ALEN], chipcode = 0;
+   u8 buf[ETH_ALEN] = {0}, chipcode = 0;
u32 phyid;
struct asix_common_private *priv;
 
@@ -1061,7 +1061,7 @@ static const struct net_device_ops ax88178_netdev_ops = {
 static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
 {
int ret;
-   u8 buf[ETH_ALEN];
+   u8 buf[ETH_ALEN] = {0};
 
usbnet_get_endpoints(dev,intf);
 
-- 
2.11.0



Re: [PATCH] net: usb: asix: init MAC address buffers

2019-07-01 Thread Phong Tran
Hello Dan,

On Mon, Jul 1, 2019 at 10:30 PM Dan Williams  wrote:
>
> On Mon, 2019-07-01 at 06:45 +0700, Phong Tran wrote:
> > This is for fixing bug KMSAN: uninit-value in ax88772_bind
> >
> > Tested by
> > https://groups.google.com/d/msg/syzkaller-bugs/aFQurGotng4/cFe9nxMCCwAJ
> >
> > Reported-by: syzbot+8a3fc6674bbc3978e...@syzkaller.appspotmail.com
> >
> > syzbot found the following crash on:
> >
> > HEAD commit:f75e4cfe kmsan: use kmsan_handle_urb() in urb.c
> > git tree:   kmsan
> > console output:
> > https://syzkaller.appspot.com/x/log.txt?x=136d720ea0
> > kernel config:
> > https://syzkaller.appspot.com/x/.config?x=602468164ccdc30a
> > dashboard link:
> > https://syzkaller.appspot.com/bug?extid=8a3fc6674bbc3978ed4e
> > compiler:   clang version 9.0.0 (/home/glider/llvm/clang
> > 06d00afa61eef8f7f501ebdb4e8612ea43ec2d78)
> > syz repro:
> > https://syzkaller.appspot.com/x/repro.syz?x=12788316a0
> > C reproducer:
> > https://syzkaller.appspot.com/x/repro.c?x=120359aaa0
> >
> > ==
> > BUG: KMSAN: uninit-value in is_valid_ether_addr
> > include/linux/etherdevice.h:200 [inline]
> > BUG: KMSAN: uninit-value in asix_set_netdev_dev_addr
> > drivers/net/usb/asix_devices.c:73 [inline]
> > BUG: KMSAN: uninit-value in ax88772_bind+0x93d/0x11e0
> > drivers/net/usb/asix_devices.c:724
> > CPU: 0 PID: 3348 Comm: kworker/0:2 Not tainted 5.1.0+ #1
> > Hardware name: Google Google Compute Engine/Google Compute Engine,
> > BIOS
> > Google 01/01/2011
> > Workqueue: usb_hub_wq hub_event
> > Call Trace:
> >   __dump_stack lib/dump_stack.c:77 [inline]
> >   dump_stack+0x191/0x1f0 lib/dump_stack.c:113
> >   kmsan_report+0x130/0x2a0 mm/kmsan/kmsan.c:622
> >   __msan_warning+0x75/0xe0 mm/kmsan/kmsan_instr.c:310
> >   is_valid_ether_addr include/linux/etherdevice.h:200 [inline]
> >   asix_set_netdev_dev_addr drivers/net/usb/asix_devices.c:73 [inline]
> >   ax88772_bind+0x93d/0x11e0 drivers/net/usb/asix_devices.c:724
> >   usbnet_probe+0x10f5/0x3940 drivers/net/usb/usbnet.c:1728
> >   usb_probe_interface+0xd66/0x1320 drivers/usb/core/driver.c:361
> >   really_probe+0xdae/0x1d80 drivers/base/dd.c:513
> >   driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671
> >   __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778
> >   bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454
> >   __device_attach+0x454/0x730 drivers/base/dd.c:844
> >   device_initial_probe+0x4a/0x60 drivers/base/dd.c:891
> >   bus_probe_device+0x137/0x390 drivers/base/bus.c:514
> >   device_add+0x288d/0x30e0 drivers/base/core.c:2106
> >   usb_set_configuration+0x30dc/0x3750 drivers/usb/core/message.c:2027
> >   generic_probe+0xe7/0x280 drivers/usb/core/generic.c:210
> >   usb_probe_device+0x14c/0x200 drivers/usb/core/driver.c:266
> >   really_probe+0xdae/0x1d80 drivers/base/dd.c:513
> >   driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671
> >   __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778
> >   bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454
> >   __device_attach+0x454/0x730 drivers/base/dd.c:844
> >   device_initial_probe+0x4a/0x60 drivers/base/dd.c:891
> >   bus_probe_device+0x137/0x390 drivers/base/bus.c:514
> >   device_add+0x288d/0x30e0 drivers/base/core.c:2106
> >   usb_new_device+0x23e5/0x2ff0 drivers/usb/core/hub.c:2534
> >   hub_port_connect drivers/usb/core/hub.c:5089 [inline]
> >   hub_port_connect_change drivers/usb/core/hub.c:5204 [inline]
> >   port_event drivers/usb/core/hub.c:5350 [inline]
> >   hub_event+0x48d1/0x7290 drivers/usb/core/hub.c:5432
> >   process_one_work+0x1572/0x1f00 kernel/workqueue.c:2269
> >   process_scheduled_works kernel/workqueue.c:2331 [inline]
> >   worker_thread+0x189c/0x2460 kernel/workqueue.c:2417
> >   kthread+0x4b5/0x4f0 kernel/kthread.c:254
> >   ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355
> >
> > Signed-off-by: Phong Tran 
> > ---
> >  drivers/net/usb/asix_devices.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/usb/asix_devices.c
> > b/drivers/net/usb/asix_devices.c
> > index c9bc96310ed4..f514d19316b1 100644
> > --- a/drivers/net/usb/asix_devices.c
> > +++ b/drivers/net/usb/asix_devices.c
> > @@ -230,6 +230,7 @@ static int ax88172_bind(struct usbnet *dev,
> > struct usb_interface *intf)
> >   int i;
> >   unsigned long gpio_bits = dev->driver_info->data;
> >
> > + memset(buf, 0, sizeof(buf));
>
> For array variables defined in the function itself, isn't this usually
> done with:
>
>  int ret = 0;
> -u8 buf[ETH_ALEN];
> +u8 buf[ETH_ALEN] = {0};
>  int i;
>  unsigned long gpio_bits = dev->driver_info->data;
>
> eg make the compiler do it (though maybe it's smart enough to elide the
> memset, I don't know). See drivers/net/ethernet/intel/igb/e1000_mac.c
> for an example.
>

Thank suggestion, applied in v2 without using memset().

Phong


[PATCH] net: usb: asix: init MAC address buffers

2019-06-30 Thread Phong Tran
This is for fixing bug KMSAN: uninit-value in ax88772_bind

Tested by
https://groups.google.com/d/msg/syzkaller-bugs/aFQurGotng4/cFe9nxMCCwAJ

Reported-by: syzbot+8a3fc6674bbc3978e...@syzkaller.appspotmail.com

syzbot found the following crash on:

HEAD commit:f75e4cfe kmsan: use kmsan_handle_urb() in urb.c
git tree:   kmsan
console output: https://syzkaller.appspot.com/x/log.txt?x=136d720ea0
kernel config:
https://syzkaller.appspot.com/x/.config?x=602468164ccdc30a
dashboard link:
https://syzkaller.appspot.com/bug?extid=8a3fc6674bbc3978ed4e
compiler:   clang version 9.0.0 (/home/glider/llvm/clang
06d00afa61eef8f7f501ebdb4e8612ea43ec2d78)
syz repro:
https://syzkaller.appspot.com/x/repro.syz?x=12788316a0
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=120359aaa0

==
BUG: KMSAN: uninit-value in is_valid_ether_addr
include/linux/etherdevice.h:200 [inline]
BUG: KMSAN: uninit-value in asix_set_netdev_dev_addr
drivers/net/usb/asix_devices.c:73 [inline]
BUG: KMSAN: uninit-value in ax88772_bind+0x93d/0x11e0
drivers/net/usb/asix_devices.c:724
CPU: 0 PID: 3348 Comm: kworker/0:2 Not tainted 5.1.0+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x191/0x1f0 lib/dump_stack.c:113
  kmsan_report+0x130/0x2a0 mm/kmsan/kmsan.c:622
  __msan_warning+0x75/0xe0 mm/kmsan/kmsan_instr.c:310
  is_valid_ether_addr include/linux/etherdevice.h:200 [inline]
  asix_set_netdev_dev_addr drivers/net/usb/asix_devices.c:73 [inline]
  ax88772_bind+0x93d/0x11e0 drivers/net/usb/asix_devices.c:724
  usbnet_probe+0x10f5/0x3940 drivers/net/usb/usbnet.c:1728
  usb_probe_interface+0xd66/0x1320 drivers/usb/core/driver.c:361
  really_probe+0xdae/0x1d80 drivers/base/dd.c:513
  driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671
  __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778
  bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454
  __device_attach+0x454/0x730 drivers/base/dd.c:844
  device_initial_probe+0x4a/0x60 drivers/base/dd.c:891
  bus_probe_device+0x137/0x390 drivers/base/bus.c:514
  device_add+0x288d/0x30e0 drivers/base/core.c:2106
  usb_set_configuration+0x30dc/0x3750 drivers/usb/core/message.c:2027
  generic_probe+0xe7/0x280 drivers/usb/core/generic.c:210
  usb_probe_device+0x14c/0x200 drivers/usb/core/driver.c:266
  really_probe+0xdae/0x1d80 drivers/base/dd.c:513
  driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671
  __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778
  bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454
  __device_attach+0x454/0x730 drivers/base/dd.c:844
  device_initial_probe+0x4a/0x60 drivers/base/dd.c:891
  bus_probe_device+0x137/0x390 drivers/base/bus.c:514
  device_add+0x288d/0x30e0 drivers/base/core.c:2106
  usb_new_device+0x23e5/0x2ff0 drivers/usb/core/hub.c:2534
  hub_port_connect drivers/usb/core/hub.c:5089 [inline]
  hub_port_connect_change drivers/usb/core/hub.c:5204 [inline]
  port_event drivers/usb/core/hub.c:5350 [inline]
  hub_event+0x48d1/0x7290 drivers/usb/core/hub.c:5432
  process_one_work+0x1572/0x1f00 kernel/workqueue.c:2269
  process_scheduled_works kernel/workqueue.c:2331 [inline]
  worker_thread+0x189c/0x2460 kernel/workqueue.c:2417
  kthread+0x4b5/0x4f0 kernel/kthread.c:254
  ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355

Signed-off-by: Phong Tran 
---
 drivers/net/usb/asix_devices.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index c9bc96310ed4..f514d19316b1 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -230,6 +230,7 @@ static int ax88172_bind(struct usbnet *dev, struct 
usb_interface *intf)
int i;
unsigned long gpio_bits = dev->driver_info->data;
 
+   memset(buf, 0, sizeof(buf));
usbnet_get_endpoints(dev,intf);
 
/* Toggle the GPIOs in a manufacturer/model specific way */
@@ -681,6 +682,7 @@ static int ax88772_bind(struct usbnet *dev, struct 
usb_interface *intf)
u32 phyid;
struct asix_common_private *priv;
 
+   memset(buf, 0, sizeof(buf));
usbnet_get_endpoints(dev, intf);
 
/* Maybe the boot loader passed the MAC address via device tree */
@@ -1063,6 +1065,7 @@ static int ax88178_bind(struct usbnet *dev, struct 
usb_interface *intf)
int ret;
u8 buf[ETH_ALEN];
 
+   memset(buf, 0, sizeof(buf));
usbnet_get_endpoints(dev,intf);
 
/* Get the MAC address */
-- 
2.11.0



[PATCH 06/15] ARM: imx: cleanup cppcheck shifting errors

2019-06-23 Thread Phong Tran
[arch/arm/mach-imx/iomux-mx3.h:93]: (error) Shifting signed 32-bit value
by 31 bits is undefined behaviour

Signed-off-by: Phong Tran 
---
 arch/arm/mach-imx/iomux-mx3.h | 64 +--
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/arch/arm/mach-imx/iomux-mx3.h b/arch/arm/mach-imx/iomux-mx3.h
index 99270a183d47..c30951dd110d 100644
--- a/arch/arm/mach-imx/iomux-mx3.h
+++ b/arch/arm/mach-imx/iomux-mx3.h
@@ -59,38 +59,38 @@ enum iomux_pad_config {
  * various IOMUX general purpose functions
  */
 enum iomux_gp_func {
-   MUX_PGP_FIRI= 1 << 0,
-   MUX_DDR_MODE= 1 << 1,
-   MUX_PGP_CSPI_BB = 1 << 2,
-   MUX_PGP_ATA_1   = 1 << 3,
-   MUX_PGP_ATA_2   = 1 << 4,
-   MUX_PGP_ATA_3   = 1 << 5,
-   MUX_PGP_ATA_4   = 1 << 6,
-   MUX_PGP_ATA_5   = 1 << 7,
-   MUX_PGP_ATA_6   = 1 << 8,
-   MUX_PGP_ATA_7   = 1 << 9,
-   MUX_PGP_ATA_8   = 1 << 10,
-   MUX_PGP_UH2 = 1 << 11,
-   MUX_SDCTL_CSD0_SEL  = 1 << 12,
-   MUX_SDCTL_CSD1_SEL  = 1 << 13,
-   MUX_CSPI1_UART3 = 1 << 14,
-   MUX_EXTDMAREQ2_MBX_SEL  = 1 << 15,
-   MUX_TAMPER_DETECT_EN= 1 << 16,
-   MUX_PGP_USB_4WIRE   = 1 << 17,
-   MUX_PGP_USB_COMMON  = 1 << 18,
-   MUX_SDHC_MEMSTICK1  = 1 << 19,
-   MUX_SDHC_MEMSTICK2  = 1 << 20,
-   MUX_PGP_SPLL_BYP= 1 << 21,
-   MUX_PGP_UPLL_BYP= 1 << 22,
-   MUX_PGP_MSHC1_CLK_SEL   = 1 << 23,
-   MUX_PGP_MSHC2_CLK_SEL   = 1 << 24,
-   MUX_CSPI3_UART5_SEL = 1 << 25,
-   MUX_PGP_ATA_9   = 1 << 26,
-   MUX_PGP_USB_SUSPEND = 1 << 27,
-   MUX_PGP_USB_OTG_LOOPBACK= 1 << 28,
-   MUX_PGP_USB_HS1_LOOPBACK= 1 << 29,
-   MUX_PGP_USB_HS2_LOOPBACK= 1 << 30,
-   MUX_CLKO_DDR_MODE   = 1 << 31,
+   MUX_PGP_FIRI= 1U << 0,
+   MUX_DDR_MODE= 1U << 1,
+   MUX_PGP_CSPI_BB = 1U << 2,
+   MUX_PGP_ATA_1   = 1U << 3,
+   MUX_PGP_ATA_2   = 1U << 4,
+   MUX_PGP_ATA_3   = 1U << 5,
+   MUX_PGP_ATA_4   = 1U << 6,
+   MUX_PGP_ATA_5   = 1U << 7,
+   MUX_PGP_ATA_6   = 1U << 8,
+   MUX_PGP_ATA_7   = 1U << 9,
+   MUX_PGP_ATA_8   = 1U << 10,
+   MUX_PGP_UH2 = 1U << 11,
+   MUX_SDCTL_CSD0_SEL  = 1U << 12,
+   MUX_SDCTL_CSD1_SEL  = 1U << 13,
+   MUX_CSPI1_UART3 = 1U << 14,
+   MUX_EXTDMAREQ2_MBX_SEL  = 1U << 15,
+   MUX_TAMPER_DETECT_EN= 1U << 16,
+   MUX_PGP_USB_4WIRE   = 1U << 17,
+   MUX_PGP_USB_COMMON  = 1U << 18,
+   MUX_SDHC_MEMSTICK1  = 1U << 19,
+   MUX_SDHC_MEMSTICK2  = 1U << 20,
+   MUX_PGP_SPLL_BYP= 1U << 21,
+   MUX_PGP_UPLL_BYP= 1U << 22,
+   MUX_PGP_MSHC1_CLK_SEL   = 1U << 23,
+   MUX_PGP_MSHC2_CLK_SEL   = 1U << 24,
+   MUX_CSPI3_UART5_SEL = 1U << 25,
+   MUX_PGP_ATA_9   = 1U << 26,
+   MUX_PGP_USB_SUSPEND = 1U << 27,
+   MUX_PGP_USB_OTG_LOOPBACK= 1U << 28,
+   MUX_PGP_USB_HS1_LOOPBACK= 1U << 29,
+   MUX_PGP_USB_HS2_LOOPBACK= 1U << 30,
+   MUX_CLKO_DDR_MODE   = 1U << 31,
 };
 
 /*
-- 
2.11.0



[PATCH] power: supply: core: fix clang -Wunsequenced

2019-05-01 Thread Phong Tran
The increment operator of  pointer in be32_to_cpu() is not explicitly.
It made the warning from clang:

drivers/power/supply/power_supply_core.c:674:36: error: multiple
unsequenced modifications to 'list' [-Werror,-Wunsequenced]
drivers/power/supply/power_supply_core.c:675:41: error: multiple
unsequenced modifications to 'list' [-Werror,-Wunsequenced]

Link: https://github.com/ClangBuiltLinux/linux/issues/460

Signed-off-by: Phong Tran 
---
 drivers/power/supply/power_supply_core.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/power_supply_core.c 
b/drivers/power/supply/power_supply_core.c
index c917a8b43b2b..7cc6f5fac0d0 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -665,8 +665,10 @@ int power_supply_get_battery_info(struct power_supply *psy,
}
 
for (i = 0; i < tab_len; i++) {
-   table[i].ocv = be32_to_cpu(*list++);
-   table[i].capacity = be32_to_cpu(*list++);
+   table[i].ocv = be32_to_cpu(*list);
+   list++;
+   table[i].capacity = be32_to_cpu(*list);
+   list++;
}
}
 
-- 
2.21.0



[PATCH V2] of: fix clang -Wunsequenced for be32_to_cpu()

2019-04-30 Thread Phong Tran
Now, make the loop explicit to avoid clang warning.

./include/linux/of.h:238:37: warning: multiple unsequenced modifications
to 'cell' [-Wunsequenced]
r = (r << 32) | be32_to_cpu(*(cell++));
  ^~
./include/linux/byteorder/generic.h:95:21: note: expanded from macro
'be32_to_cpu'
^
./include/uapi/linux/byteorder/little_endian.h:40:59: note: expanded
from macro '__be32_to_cpu'
  ^
./include/uapi/linux/swab.h:118:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
   ^
./include/uapi/linux/swab.h:18:12: note: expanded from macro
'___constant_swab32'
(((__u32)(x) & (__u32)0x00ffUL) << 24) |\
  ^

Signed-off-by: Phong Tran 
---
 include/linux/of.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index e240992e5cb6..71ca25ac01f6 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -234,8 +234,8 @@ extern struct device_node *of_find_all_nodes(struct 
device_node *prev);
 static inline u64 of_read_number(const __be32 *cell, int size)
 {
u64 r = 0;
-   while (size--)
-   r = (r << 32) | be32_to_cpu(*(cell++));
+   for(; size--; cell++)
+   r = (r << 32) | be32_to_cpu(*cell);
return r;
 }
 
-- 
2.21.0



Re: [PATCH] of: replace be32_to_cpu to be32_to_cpup

2019-04-30 Thread Phong Tran
On Tue, Apr 30, 2019 at 8:32 PM Christoph Hellwig  wrote:
>
> On Tue, Apr 30, 2019 at 04:00:44PM +0700, Phong Tran wrote:
> >
> > diff --git a/include/linux/of.h b/include/linux/of.h
> > index e240992e5cb6..1c35fc8f19b0 100644
> > --- a/include/linux/of.h
> > +++ b/include/linux/of.h
> > @@ -235,7 +235,7 @@ static inline u64 of_read_number(const __be32 *cell, 
> > int size)
> >  {
> >   u64 r = 0;
> >   while (size--)
> > - r = (r << 32) | be32_to_cpu(*(cell++));
> > + r = (r << 32) | be32_to_cpup(cell++);
> >   return r;
>
> This whole function looks odd.  It could simply be replaced with
> calls to get_unaligned_be64 / get_unaligned_be32.  Given that we have a
> lot of callers we can't easily do that, but at least we could try
> something like
>
It's risky. there are many callers of of_read_number().
There is suggestion from David
(https://lore.kernel.org/lkml/46b3e8edf27e4c8f98697f9e7f211...@acums.aculab.com/)
only changing the loop.

> static inline u64 of_read_number(const __be32 *cell, int size)
> {
> WARN_ON_ONCE(size < 1);
> WARN_ON_ONCE(size > 2);
>
> if (size == 1)
> return get_unaligned_be32(cell);
> return get_unaligned_be64(cell);
> }

Thank you for your support.

Phong.


[PATCH] of: replace be32_to_cpu to be32_to_cpup

2019-04-30 Thread Phong Tran
The cell is a pointer to __be32.
with the be32_to_cpu a lot of clang warning show that:

./include/linux/of.h:238:37: warning: multiple unsequenced modifications
to 'cell' [-Wunsequenced]
r = (r << 32) | be32_to_cpu(*(cell++));
  ^~
./include/linux/byteorder/generic.h:95:21: note: expanded from macro
'be32_to_cpu'
^
./include/uapi/linux/byteorder/little_endian.h:40:59: note: expanded
from macro '__be32_to_cpu'
  ^
./include/uapi/linux/swab.h:118:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
   ^
./include/uapi/linux/swab.h:18:12: note: expanded from macro
'___constant_swab32'
(((__u32)(x) & (__u32)0x00ffUL) << 24) |\
  ^

Signed-off-by: Phong Tran 
---
 include/linux/of.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index e240992e5cb6..1c35fc8f19b0 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -235,7 +235,7 @@ static inline u64 of_read_number(const __be32 *cell, int 
size)
 {
u64 r = 0;
while (size--)
-   r = (r << 32) | be32_to_cpu(*(cell++));
+   r = (r << 32) | be32_to_cpup(cell++);
return r;
 }
 
-- 
2.21.0



[PATCH] arm64: defconfig: Fix warning override MMC_BLOCK_MINORS

2016-03-23 Thread Phong Tran
Remove the duplicate of defination of CONFIG_MMC_BLOCK_MINORS.
Fixes 22b0898 ("arm64: add defconfig options for Allwinner SoCs")

Signed-off-by: Phong Tran <tranmanph...@gmail.com>
---
 arch/arm64/configs/defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index f705051..3ad26ff 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -215,7 +215,6 @@ CONFIG_MMC_SPI=y
 CONFIG_MMC_SUNXI=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_EXYNOS=y
-CONFIG_MMC_BLOCK_MINORS=16
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_SYSCON=y
-- 
1.9.1



[PATCH] arm64: defconfig: Fix warning override MMC_BLOCK_MINORS

2016-03-23 Thread Phong Tran
Remove the duplicate of defination of CONFIG_MMC_BLOCK_MINORS.
Fixes 22b0898 ("arm64: add defconfig options for Allwinner SoCs")

Signed-off-by: Phong Tran 
---
 arch/arm64/configs/defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index f705051..3ad26ff 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -215,7 +215,6 @@ CONFIG_MMC_SPI=y
 CONFIG_MMC_SUNXI=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_EXYNOS=y
-CONFIG_MMC_BLOCK_MINORS=16
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_SYSCON=y
-- 
1.9.1



[PATCH V3 1/2] staging: android: ion_test: unregister the misc device

2015-04-03 Thread Phong Tran
Add the remove() method for deregister from misc device
when it's unloaded.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_test.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 3bc461c..052d5e2 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,19 @@ static int __init ion_test_probe(struct platform_device 
*pdev)
return 0;
 }
 
+static int ion_test_remove(struct platform_device *pdev)
+{
+   struct ion_test_device *testdev;
+
+   testdev = platform_get_drvdata(pdev);
+   if (!testdev)
+   return -ENODATA;
+
+   return misc_deregister(>misc);
+}
+
 static struct platform_driver ion_test_platform_driver = {
+   .remove = ion_test_remove,
.driver = {
.name = "ion-test",
},
-- 
2.1.0

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


[PATCH V3 2/2] staging: android: ion_test: unregister the platform device

2015-04-03 Thread Phong Tran
The driver has to unregister from platform device when it's unloaded

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_test.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 052d5e2..7d6e6b6 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -272,6 +272,7 @@ static int ion_test_remove(struct platform_device *pdev)
return misc_deregister(>misc);
 }
 
+static struct platform_device *ion_test_pdev;
 static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove,
.driver = {
@@ -281,13 +282,18 @@ static struct platform_driver ion_test_platform_driver = {
 
 static int __init ion_test_init(void)
 {
-   platform_device_register_simple("ion-test", -1, NULL, 0);
+   ion_test_pdev = platform_device_register_simple("ion-test",
+   -1, NULL, 0);
+   if (!ion_test_pdev)
+   return -ENODEV;
+
return platform_driver_probe(_test_platform_driver, ion_test_probe);
 }
 
 static void __exit ion_test_exit(void)
 {
platform_driver_unregister(_test_platform_driver);
+   platform_device_unregister(ion_test_pdev);
 }
 
 module_init(ion_test_init);
-- 
2.1.0

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


[PATCH V3 0/2] Fix some issues of staging ion test driver

2015-04-03 Thread Phong Tran
Hi Greg,

I resend 2 patches
(1) add the remove() platform driver callback to
deregister the misc device
(2) unregister platform device when driver is unloaded

Changes from v2:
Remove the extra space of patch (1)

Changes from v1:
Imporve the coding style

Phong Tran (2):
  (1) staging: android: ion_test: unregister the misc device
  (2) staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

-- 
2.1.0

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


[PATCH V3 0/2] Fix some issues of staging ion test driver

2015-04-03 Thread Phong Tran
Hi Greg,

I resend 2 patches
(1) add the remove() platform driver callback to
deregister the misc device
(2) unregister platform device when driver is unloaded

Changes from v2:
Remove the extra space of patch (1)

Changes from v1:
Imporve the coding style

Phong Tran (2):
  (1) staging: android: ion_test: unregister the misc device
  (2) staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3 2/2] staging: android: ion_test: unregister the platform device

2015-04-03 Thread Phong Tran
The driver has to unregister from platform device when it's unloaded

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 052d5e2..7d6e6b6 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -272,6 +272,7 @@ static int ion_test_remove(struct platform_device *pdev)
return misc_deregister(testdev-misc);
 }
 
+static struct platform_device *ion_test_pdev;
 static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove,
.driver = {
@@ -281,13 +282,18 @@ static struct platform_driver ion_test_platform_driver = {
 
 static int __init ion_test_init(void)
 {
-   platform_device_register_simple(ion-test, -1, NULL, 0);
+   ion_test_pdev = platform_device_register_simple(ion-test,
+   -1, NULL, 0);
+   if (!ion_test_pdev)
+   return -ENODEV;
+
return platform_driver_probe(ion_test_platform_driver, ion_test_probe);
 }
 
 static void __exit ion_test_exit(void)
 {
platform_driver_unregister(ion_test_platform_driver);
+   platform_device_unregister(ion_test_pdev);
 }
 
 module_init(ion_test_init);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3 1/2] staging: android: ion_test: unregister the misc device

2015-04-03 Thread Phong Tran
Add the remove() method for deregister from misc device
when it's unloaded.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 3bc461c..052d5e2 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,19 @@ static int __init ion_test_probe(struct platform_device 
*pdev)
return 0;
 }
 
+static int ion_test_remove(struct platform_device *pdev)
+{
+   struct ion_test_device *testdev;
+
+   testdev = platform_get_drvdata(pdev);
+   if (!testdev)
+   return -ENODATA;
+
+   return misc_deregister(testdev-misc);
+}
+
 static struct platform_driver ion_test_platform_driver = {
+   .remove = ion_test_remove,
.driver = {
.name = ion-test,
},
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 0/3] Fix some issues of staging ion test driver

2015-04-02 Thread Phong Tran
Hi Greg, Arve, Riley, Dan,

This patcheset fixes:
(1) Define the GPL V2 for ion_test driver
(2) Add the remove() platform driver callback to
deregister the misc device
(3) unregister platform device when driver is unloaded

Thank for Dan's reivew.

Changes from v1:
Imporve the coding style

Phong Tran (3):
  staging: android: ion_test: Add the MODULE_LICENSE macro
  staging: android: ion_test: unregister the misc device
  staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

-- 
2.1.0

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


[PATCH V2 3/3] staging: android: ion_test: unregister the platform device

2015-04-02 Thread Phong Tran
The driver has to unregister from platform device when it's unloaded

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_test.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index d6a9653..24fd77d3 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -272,6 +272,7 @@ static int ion_test_remove(struct platform_device *pdev)
return  misc_deregister(>misc);
 }
 
+static struct platform_device *ion_test_pdev;
 static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove,
.driver = {
@@ -281,13 +282,18 @@ static struct platform_driver ion_test_platform_driver = {
 
 static int __init ion_test_init(void)
 {
-   platform_device_register_simple("ion-test", -1, NULL, 0);
+   ion_test_pdev = platform_device_register_simple("ion-test",
+   -1, NULL, 0);
+   if (!ion_test_pdev)
+   return -ENODEV;
+
return platform_driver_probe(_test_platform_driver, ion_test_probe);
 }
 
 static void __exit ion_test_exit(void)
 {
platform_driver_unregister(_test_platform_driver);
+   platform_device_unregister(ion_test_pdev);
 }
 
 module_init(ion_test_init);
-- 
2.1.0

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


[PATCH V2 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro

2015-04-02 Thread Phong Tran
Base on the file comment should define GPL v2 for ion test driver

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 654acb5..3bc461c 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -280,3 +280,4 @@ static void __exit ion_test_exit(void)
 
 module_init(ion_test_init);
 module_exit(ion_test_exit);
+MODULE_LICENSE("GPL v2");
-- 
2.1.0

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


[PATCH V2 2/3] staging: android: ion_test: unregister the misc device

2015-04-02 Thread Phong Tran
Add the remove() method for deregister from misc device
when it's unloaded.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_test.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 3bc461c..d6a9653 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,19 @@ static int __init ion_test_probe(struct platform_device 
*pdev)
return 0;
 }
 
+static int ion_test_remove(struct platform_device *pdev)
+{
+   struct ion_test_device *testdev;
+
+   testdev = platform_get_drvdata(pdev);
+   if (!testdev)
+   return -ENODATA;
+
+   return  misc_deregister(>misc);
+}
+
 static struct platform_driver ion_test_platform_driver = {
+   .remove = ion_test_remove,
.driver = {
.name = "ion-test",
},
-- 
2.1.0

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


[PATCH V2 3/3] staging: android: ion_test: unregister the platform device

2015-04-02 Thread Phong Tran
The driver has to unregister from platform device when it's unloaded

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index d6a9653..24fd77d3 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -272,6 +272,7 @@ static int ion_test_remove(struct platform_device *pdev)
return  misc_deregister(testdev-misc);
 }
 
+static struct platform_device *ion_test_pdev;
 static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove,
.driver = {
@@ -281,13 +282,18 @@ static struct platform_driver ion_test_platform_driver = {
 
 static int __init ion_test_init(void)
 {
-   platform_device_register_simple(ion-test, -1, NULL, 0);
+   ion_test_pdev = platform_device_register_simple(ion-test,
+   -1, NULL, 0);
+   if (!ion_test_pdev)
+   return -ENODEV;
+
return platform_driver_probe(ion_test_platform_driver, ion_test_probe);
 }
 
 static void __exit ion_test_exit(void)
 {
platform_driver_unregister(ion_test_platform_driver);
+   platform_device_unregister(ion_test_pdev);
 }
 
 module_init(ion_test_init);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro

2015-04-02 Thread Phong Tran
Base on the file comment should define GPL v2 for ion test driver

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 654acb5..3bc461c 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -280,3 +280,4 @@ static void __exit ion_test_exit(void)
 
 module_init(ion_test_init);
 module_exit(ion_test_exit);
+MODULE_LICENSE(GPL v2);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 0/3] Fix some issues of staging ion test driver

2015-04-02 Thread Phong Tran
Hi Greg, Arve, Riley, Dan,

This patcheset fixes:
(1) Define the GPL V2 for ion_test driver
(2) Add the remove() platform driver callback to
deregister the misc device
(3) unregister platform device when driver is unloaded

Thank for Dan's reivew.

Changes from v1:
Imporve the coding style

Phong Tran (3):
  staging: android: ion_test: Add the MODULE_LICENSE macro
  staging: android: ion_test: unregister the misc device
  staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 2/3] staging: android: ion_test: unregister the misc device

2015-04-02 Thread Phong Tran
Add the remove() method for deregister from misc device
when it's unloaded.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 3bc461c..d6a9653 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,19 @@ static int __init ion_test_probe(struct platform_device 
*pdev)
return 0;
 }
 
+static int ion_test_remove(struct platform_device *pdev)
+{
+   struct ion_test_device *testdev;
+
+   testdev = platform_get_drvdata(pdev);
+   if (!testdev)
+   return -ENODATA;
+
+   return  misc_deregister(testdev-misc);
+}
+
 static struct platform_driver ion_test_platform_driver = {
+   .remove = ion_test_remove,
.driver = {
.name = ion-test,
},
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] staging: android: ion_test: unregister the misc device

2015-04-01 Thread Phong Tran
Add the remove() method for deregister from misc device
when it's unloaded.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_test.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 3bc461c..f36a35e 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,25 @@ static int __init ion_test_probe(struct platform_device 
*pdev)
return 0;
 }
 
+static int ion_test_remove(struct platform_device *pdev)
+{
+   int ret = 0;
+   struct ion_test_device *testdev;
+
+   testdev = platform_get_drvdata(pdev);
+
+   if (!testdev) {
+   pr_err("failed to get pdev data.\n");
+   return -ENODATA;
+   }
+
+   ret = misc_deregister(>misc);
+
+   return ret;
+}
+
 static struct platform_driver ion_test_platform_driver = {
+   .remove = ion_test_remove,
.driver = {
.name = "ion-test",
},
-- 
2.1.0

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


[PATCH 3/3] staging: android: ion_test: unregister the platform device

2015-04-01 Thread Phong Tran
The driver has to unregister from platform device when it's unloaded

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_test.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index f36a35e..d2a236e 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -278,6 +278,7 @@ static int ion_test_remove(struct platform_device *pdev)
return ret;
 }
 
+static struct platform_device *ion_test_platform_device;
 static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove,
.driver = {
@@ -287,13 +288,21 @@ static struct platform_driver ion_test_platform_driver = {
 
 static int __init ion_test_init(void)
 {
-   platform_device_register_simple("ion-test", -1, NULL, 0);
+   ion_test_platform_device = platform_device_register_simple("ion-test",
+  -1, NULL, 0);
+
+   if (!ion_test_platform_device) {
+   pr_err("failed to register ion-test platform device\n");
+   return -ENODEV;
+   }
+
return platform_driver_probe(_test_platform_driver, ion_test_probe);
 }
 
 static void __exit ion_test_exit(void)
 {
platform_driver_unregister(_test_platform_driver);
+   platform_device_unregister(ion_test_platform_device);
 }
 
 module_init(ion_test_init);
-- 
2.1.0

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


[PATCH 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro

2015-04-01 Thread Phong Tran
Base on the file comment should define GPL v2 for ion test driver

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 654acb5..3bc461c 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -280,3 +280,4 @@ static void __exit ion_test_exit(void)
 
 module_init(ion_test_init);
 module_exit(ion_test_exit);
+MODULE_LICENSE("GPL v2");
-- 
2.1.0

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


[PATCH 0/3] Fix some issues of staging ion test driver

2015-04-01 Thread Phong Tran
Hi Greg, Arve, Riley,

This patcheset fixes:
(1) Define the GPL V2 for ion_test driver
(2) Add the remove() platform driver callback to
deregister the misc device
(3) unregister platform device when driver is unloaded

Phong Tran (3):
  staging: android: ion_test: Add the MODULE_LICENSE macro
  staging: android: ion_test: unregister the misc device
  staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

-- 
2.1.0

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


[PATCH 0/3] Fix some issues of staging ion test driver

2015-04-01 Thread Phong Tran
Hi Greg, Arve, Riley,

This patcheset fixes:
(1) Define the GPL V2 for ion_test driver
(2) Add the remove() platform driver callback to
deregister the misc device
(3) unregister platform device when driver is unloaded

Phong Tran (3):
  staging: android: ion_test: Add the MODULE_LICENSE macro
  staging: android: ion_test: unregister the misc device
  staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro

2015-04-01 Thread Phong Tran
Base on the file comment should define GPL v2 for ion test driver

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 654acb5..3bc461c 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -280,3 +280,4 @@ static void __exit ion_test_exit(void)
 
 module_init(ion_test_init);
 module_exit(ion_test_exit);
+MODULE_LICENSE(GPL v2);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] staging: android: ion_test: unregister the platform device

2015-04-01 Thread Phong Tran
The driver has to unregister from platform device when it's unloaded

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index f36a35e..d2a236e 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -278,6 +278,7 @@ static int ion_test_remove(struct platform_device *pdev)
return ret;
 }
 
+static struct platform_device *ion_test_platform_device;
 static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove,
.driver = {
@@ -287,13 +288,21 @@ static struct platform_driver ion_test_platform_driver = {
 
 static int __init ion_test_init(void)
 {
-   platform_device_register_simple(ion-test, -1, NULL, 0);
+   ion_test_platform_device = platform_device_register_simple(ion-test,
+  -1, NULL, 0);
+
+   if (!ion_test_platform_device) {
+   pr_err(failed to register ion-test platform device\n);
+   return -ENODEV;
+   }
+
return platform_driver_probe(ion_test_platform_driver, ion_test_probe);
 }
 
 static void __exit ion_test_exit(void)
 {
platform_driver_unregister(ion_test_platform_driver);
+   platform_device_unregister(ion_test_platform_device);
 }
 
 module_init(ion_test_init);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] staging: android: ion_test: unregister the misc device

2015-04-01 Thread Phong Tran
Add the remove() method for deregister from misc device
when it's unloaded.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 3bc461c..f36a35e 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,25 @@ static int __init ion_test_probe(struct platform_device 
*pdev)
return 0;
 }
 
+static int ion_test_remove(struct platform_device *pdev)
+{
+   int ret = 0;
+   struct ion_test_device *testdev;
+
+   testdev = platform_get_drvdata(pdev);
+
+   if (!testdev) {
+   pr_err(failed to get pdev data.\n);
+   return -ENODATA;
+   }
+
+   ret = misc_deregister(testdev-misc);
+
+   return ret;
+}
+
 static struct platform_driver ion_test_platform_driver = {
+   .remove = ion_test_remove,
.driver = {
.name = ion-test,
},
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] PCI: xgene: Fix the map_bus callback prototype

2015-02-23 Thread Phong Tran
The return value should be void __iomem *.
Tested by compile only.

Signed-off-by: Phong Tran 
---
 drivers/pci/host/pci-xgene.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index aab5547..9c3bfd8 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -127,7 +127,7 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, 
int offset)
return false;
 }
 
-static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
+static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int 
devfn,
  int offset)
 {
struct xgene_pcie_port *port = bus->sysdata;
-- 
2.1.0

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


[PATCH] PCI: xgene: Fix the map_bus callback prototype

2015-02-23 Thread Phong Tran
The return value should be void __iomem *.
Tested by compile only.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/pci/host/pci-xgene.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index aab5547..9c3bfd8 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -127,7 +127,7 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, 
int offset)
return false;
 }
 
-static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
+static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int 
devfn,
  int offset)
 {
struct xgene_pcie_port *port = bus-sysdata;
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: lustre: lnet: socklnd_cb.c Fix sparse non-static symbol warning

2014-08-19 Thread Phong Tran
This patch fixes some non static function declarations that
cause sparse warning. Tested by compilation.

Signed-off-by: Phong Tran 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index 5214399..c49b01e 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -107,7 +107,7 @@ ksocknal_free_tx (ksock_tx_t *tx)
}
 }
 
-int
+static int
 ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
 {
struct iovec  *iov = tx->tx_iov;
@@ -144,7 +144,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
return rc;
 }
 
-int
+static int
 ksocknal_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
 {
lnet_kiov_t*kiov = tx->tx_kiov;
@@ -182,7 +182,7 @@ ksocknal_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
return rc;
 }
 
-int
+static int
 ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
 {
int  rc;
@@ -248,7 +248,7 @@ ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
return rc;
 }
 
-int
+static int
 ksocknal_recv_iov (ksock_conn_t *conn)
 {
struct iovec *iov = conn->ksnc_rx_iov;
@@ -293,7 +293,7 @@ ksocknal_recv_iov (ksock_conn_t *conn)
return rc;
 }
 
-int
+static int
 ksocknal_recv_kiov (ksock_conn_t *conn)
 {
lnet_kiov_t   *kiov = conn->ksnc_rx_kiov;
@@ -337,7 +337,7 @@ ksocknal_recv_kiov (ksock_conn_t *conn)
return 1;
 }
 
-int
+static int
 ksocknal_receive (ksock_conn_t *conn)
 {
/* Return 1 on success, 0 on EOF, < 0 on error.
@@ -499,7 +499,7 @@ ksocknal_uncheck_zc_req(ksock_tx_t *tx)
ksocknal_tx_decref(tx);
 }
 
-int
+static int
 ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
 {
int rc;
@@ -579,7 +579,7 @@ ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t 
*tx)
return rc;
 }
 
-void
+static void
 ksocknal_launch_connection_locked (ksock_route_t *route)
 {
 
@@ -1109,7 +1109,7 @@ ksocknal_new_packet (ksock_conn_t *conn, int nob_to_skip)
return 0;
 }
 
-int
+static int
 ksocknal_process_receive (ksock_conn_t *conn)
 {
lnet_hdr_t  *lhdr;
@@ -1608,7 +1608,7 @@ void ksocknal_write_callback (ksock_conn_t *conn)
spin_unlock_bh(>kss_lock);
 }
 
-ksock_proto_t *
+static ksock_proto_t *
 ksocknal_parse_proto_version (ksock_hello_msg_t *hello)
 {
__u32   version = 0;
@@ -1672,7 +1672,7 @@ ksocknal_send_hello (lnet_ni_t *ni, ksock_conn_t *conn,
return conn->ksnc_proto->pro_send_hello(conn, hello);
 }
 
-int
+static int
 ksocknal_invert_type(int type)
 {
switch (type)
@@ -1837,7 +1837,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
return 0;
 }
 
-int
+static int
 ksocknal_connect (ksock_route_t *route)
 {
LIST_HEAD(zombies);
@@ -2244,7 +2244,7 @@ ksocknal_connd (void *arg)
return 0;
 }
 
-ksock_conn_t *
+static ksock_conn_t *
 ksocknal_find_timed_out_conn (ksock_peer_t *peer)
 {
/* We're called with a shared lock on ksnd_global_lock */
@@ -2354,7 +2354,7 @@ ksocknal_flush_stale_txs(ksock_peer_t *peer)
ksocknal_txlist_done(peer->ksnp_ni, _txs, 1);
 }
 
-int
+static int
 ksocknal_send_keepalive_locked(ksock_peer_t *peer)
 {
ksock_sched_t  *sched;
@@ -2415,7 +2415,7 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer)
 }
 
 
-void
+static void
 ksocknal_check_peer_timeouts (int idx)
 {
struct list_head   *peers = _data.ksnd_peers[idx];
-- 
1.9.3

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


[PATCH] staging: lustre: lnet: socklnd_cb.c Fix sparse non-static symbol warning

2014-08-19 Thread Phong Tran
This patch fixes some non static function declarations that
cause sparse warning. Tested by compilation.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index 5214399..c49b01e 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -107,7 +107,7 @@ ksocknal_free_tx (ksock_tx_t *tx)
}
 }
 
-int
+static int
 ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
 {
struct iovec  *iov = tx-tx_iov;
@@ -144,7 +144,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
return rc;
 }
 
-int
+static int
 ksocknal_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
 {
lnet_kiov_t*kiov = tx-tx_kiov;
@@ -182,7 +182,7 @@ ksocknal_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
return rc;
 }
 
-int
+static int
 ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
 {
int  rc;
@@ -248,7 +248,7 @@ ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
return rc;
 }
 
-int
+static int
 ksocknal_recv_iov (ksock_conn_t *conn)
 {
struct iovec *iov = conn-ksnc_rx_iov;
@@ -293,7 +293,7 @@ ksocknal_recv_iov (ksock_conn_t *conn)
return rc;
 }
 
-int
+static int
 ksocknal_recv_kiov (ksock_conn_t *conn)
 {
lnet_kiov_t   *kiov = conn-ksnc_rx_kiov;
@@ -337,7 +337,7 @@ ksocknal_recv_kiov (ksock_conn_t *conn)
return 1;
 }
 
-int
+static int
 ksocknal_receive (ksock_conn_t *conn)
 {
/* Return 1 on success, 0 on EOF,  0 on error.
@@ -499,7 +499,7 @@ ksocknal_uncheck_zc_req(ksock_tx_t *tx)
ksocknal_tx_decref(tx);
 }
 
-int
+static int
 ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
 {
int rc;
@@ -579,7 +579,7 @@ ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t 
*tx)
return rc;
 }
 
-void
+static void
 ksocknal_launch_connection_locked (ksock_route_t *route)
 {
 
@@ -1109,7 +1109,7 @@ ksocknal_new_packet (ksock_conn_t *conn, int nob_to_skip)
return 0;
 }
 
-int
+static int
 ksocknal_process_receive (ksock_conn_t *conn)
 {
lnet_hdr_t  *lhdr;
@@ -1608,7 +1608,7 @@ void ksocknal_write_callback (ksock_conn_t *conn)
spin_unlock_bh(sched-kss_lock);
 }
 
-ksock_proto_t *
+static ksock_proto_t *
 ksocknal_parse_proto_version (ksock_hello_msg_t *hello)
 {
__u32   version = 0;
@@ -1672,7 +1672,7 @@ ksocknal_send_hello (lnet_ni_t *ni, ksock_conn_t *conn,
return conn-ksnc_proto-pro_send_hello(conn, hello);
 }
 
-int
+static int
 ksocknal_invert_type(int type)
 {
switch (type)
@@ -1837,7 +1837,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
return 0;
 }
 
-int
+static int
 ksocknal_connect (ksock_route_t *route)
 {
LIST_HEAD(zombies);
@@ -2244,7 +2244,7 @@ ksocknal_connd (void *arg)
return 0;
 }
 
-ksock_conn_t *
+static ksock_conn_t *
 ksocknal_find_timed_out_conn (ksock_peer_t *peer)
 {
/* We're called with a shared lock on ksnd_global_lock */
@@ -2354,7 +2354,7 @@ ksocknal_flush_stale_txs(ksock_peer_t *peer)
ksocknal_txlist_done(peer-ksnp_ni, stale_txs, 1);
 }
 
-int
+static int
 ksocknal_send_keepalive_locked(ksock_peer_t *peer)
 {
ksock_sched_t  *sched;
@@ -2415,7 +2415,7 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer)
 }
 
 
-void
+static void
 ksocknal_check_peer_timeouts (int idx)
 {
struct list_head   *peers = ksocknal_data.ksnd_peers[idx];
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tools: selftests: Fixing build issue with make kselftests target

2014-08-17 Thread Phong Tran
Fix the typo of ARCH when build with 'make kselftests'
Change the 'X86' to 'x86'. Test by compilation

Signed-off-by: Phong Tran 
---
 tools/testing/selftests/ipc/Makefile   |  6 +++---
 tools/testing/selftests/kcmp/Makefile  |  6 +++---
 tools/testing/selftests/memfd/Makefile | 10 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/testing/selftests/ipc/Makefile 
b/tools/testing/selftests/ipc/Makefile
index 5386fd7..74bbefd 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -1,18 +1,18 @@
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 ifeq ($(ARCH),i386)
-ARCH := X86
+ARCH := x86
CFLAGS := -DCONFIG_X86_32 -D__i386__
 endif
 ifeq ($(ARCH),x86_64)
-   ARCH := X86
+   ARCH := x86
CFLAGS := -DCONFIG_X86_64 -D__x86_64__
 endif
 
 CFLAGS += -I../../../../usr/include/
 
 all:
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) msgque.c -o msgque_test
 else
echo "Not an x86 target, can't build msgque selftest"
diff --git a/tools/testing/selftests/kcmp/Makefile 
b/tools/testing/selftests/kcmp/Makefile
index d7d6bbe..8aabd82 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -1,11 +1,11 @@
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 ifeq ($(ARCH),i386)
-ARCH := X86
+ARCH := x86
CFLAGS := -DCONFIG_X86_32 -D__i386__
 endif
 ifeq ($(ARCH),x86_64)
-   ARCH := X86
+   ARCH := x86
CFLAGS := -DCONFIG_X86_64 -D__x86_64__
 endif
 
@@ -15,7 +15,7 @@ CFLAGS += -I../../../../usr/include/
 CFLAGS += -I../../../../arch/x86/include/
 
 all:
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) kcmp_test.c -o kcmp_test
 else
echo "Not an x86 target, can't build kcmp selftest"
diff --git a/tools/testing/selftests/memfd/Makefile 
b/tools/testing/selftests/memfd/Makefile
index 6816c49..ad4ab01 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -1,10 +1,10 @@
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 ifeq ($(ARCH),i386)
-   ARCH := X86
+   ARCH := x86
 endif
 ifeq ($(ARCH),x86_64)
-   ARCH := X86
+   ARCH := x86
 endif
 
 CFLAGS += -D_FILE_OFFSET_BITS=64
@@ -14,20 +14,20 @@ CFLAGS += -I../../../../include/uapi/
 CFLAGS += -I../../../../include/
 
 all:
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) memfd_test.c -o memfd_test
 else
echo "Not an x86 target, can't build memfd selftest"
 endif
 
 run_tests: all
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) memfd_test.c -o memfd_test
 endif
@./memfd_test || echo "memfd_test: [FAIL]"
 
 build_fuse:
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt
gcc $(CFLAGS) fuse_test.c -o fuse_test
 else
-- 
1.9.3

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


[PATCH] tools: selftests: Fixing build issue with make kselftests target

2014-08-17 Thread Phong Tran
Fix the typo of ARCH when build with 'make kselftests'
Change the 'X86' to 'x86'. Test by compilation

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 tools/testing/selftests/ipc/Makefile   |  6 +++---
 tools/testing/selftests/kcmp/Makefile  |  6 +++---
 tools/testing/selftests/memfd/Makefile | 10 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/testing/selftests/ipc/Makefile 
b/tools/testing/selftests/ipc/Makefile
index 5386fd7..74bbefd 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -1,18 +1,18 @@
 uname_M := $(shell uname -m 2/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 ifeq ($(ARCH),i386)
-ARCH := X86
+ARCH := x86
CFLAGS := -DCONFIG_X86_32 -D__i386__
 endif
 ifeq ($(ARCH),x86_64)
-   ARCH := X86
+   ARCH := x86
CFLAGS := -DCONFIG_X86_64 -D__x86_64__
 endif
 
 CFLAGS += -I../../../../usr/include/
 
 all:
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) msgque.c -o msgque_test
 else
echo Not an x86 target, can't build msgque selftest
diff --git a/tools/testing/selftests/kcmp/Makefile 
b/tools/testing/selftests/kcmp/Makefile
index d7d6bbe..8aabd82 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -1,11 +1,11 @@
 uname_M := $(shell uname -m 2/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 ifeq ($(ARCH),i386)
-ARCH := X86
+ARCH := x86
CFLAGS := -DCONFIG_X86_32 -D__i386__
 endif
 ifeq ($(ARCH),x86_64)
-   ARCH := X86
+   ARCH := x86
CFLAGS := -DCONFIG_X86_64 -D__x86_64__
 endif
 
@@ -15,7 +15,7 @@ CFLAGS += -I../../../../usr/include/
 CFLAGS += -I../../../../arch/x86/include/
 
 all:
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) kcmp_test.c -o kcmp_test
 else
echo Not an x86 target, can't build kcmp selftest
diff --git a/tools/testing/selftests/memfd/Makefile 
b/tools/testing/selftests/memfd/Makefile
index 6816c49..ad4ab01 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -1,10 +1,10 @@
 uname_M := $(shell uname -m 2/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 ifeq ($(ARCH),i386)
-   ARCH := X86
+   ARCH := x86
 endif
 ifeq ($(ARCH),x86_64)
-   ARCH := X86
+   ARCH := x86
 endif
 
 CFLAGS += -D_FILE_OFFSET_BITS=64
@@ -14,20 +14,20 @@ CFLAGS += -I../../../../include/uapi/
 CFLAGS += -I../../../../include/
 
 all:
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) memfd_test.c -o memfd_test
 else
echo Not an x86 target, can't build memfd selftest
 endif
 
 run_tests: all
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) memfd_test.c -o memfd_test
 endif
@./memfd_test || echo memfd_test: [FAIL]
 
 build_fuse:
-ifeq ($(ARCH),X86)
+ifeq ($(ARCH),x86)
gcc $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt
gcc $(CFLAGS) fuse_test.c -o fuse_test
 else
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3 2/3] staging: android: ion: ion.c Add a new blank line after decleration

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 2703609..cad76ae 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
client, _client_fops);
if (!client->debug_root) {
char buf[256], *path;
+
path = dentry_path(dev->clients_debug_root, buf, 256);
pr_err("Failed to create client debugfs at %s/%s\n",
path, client->display_name);
-- 
1.9.3

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


[PATCH V3 3/3] staging: android: ion: Remove redundant return of void function

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion.c   | 1 -
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 drivers/staging/android/ion/ion_chunk_heap.c| 1 -
 drivers/staging/android/ion/ion_dummy_driver.c  | 2 --
 drivers/staging/android/ion/ion_system_heap.c   | 1 -
 5 files changed, 6 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index cad76ae..56604f4 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1057,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, 
unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
   void *ptr)
 {
-   return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index dcb6f21..9156d82 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct 
ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_chunk_heap.c 
b/drivers/staging/android/ion/ion_chunk_heap.c
index 9c3e49a..3e6ec2e 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct 
ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 6d0a38a..f3ea1c3 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
chunk_ptr = NULL;
}
-
-   return;
 }
 __exitcall(ion_dummy_exit);
diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 6b77c51..da2a63c 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct 
ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
  struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
-- 
1.9.3

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


[PATCH V3 1/3] staging: android: ion: ion_dummy_driver.c Replace kzalloc() by kcalloc()

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_dummy_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 3a45e79..6d0a38a 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
int i, err;
 
idev = ion_device_create(NULL);
-   heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+   heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
GFP_KERNEL);
if (!heaps)
return -ENOMEM;
-- 
1.9.3

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


[Patch V2 3/3] staging: android: ion: Fix coding style

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
- Remove the return of void function
Tested by compilation.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion.c   | 1 -
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 drivers/staging/android/ion/ion_chunk_heap.c| 1 -
 drivers/staging/android/ion/ion_dummy_driver.c  | 2 --
 drivers/staging/android/ion/ion_system_heap.c   | 1 -
 5 files changed, 6 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index cad76ae..56604f4 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1057,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, 
unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
   void *ptr)
 {
-   return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index dcb6f21..9156d82 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct 
ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_chunk_heap.c 
b/drivers/staging/android/ion/ion_chunk_heap.c
index 9c3e49a..3e6ec2e 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct 
ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 6d0a38a..f3ea1c3 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
chunk_ptr = NULL;
}
-
-   return;
 }
 __exitcall(ion_dummy_exit);
diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 6b77c51..da2a63c 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct 
ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
  struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
-- 
1.9.3

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


[Patch V2 2/3] staging: android: ion: ion.c Fix coding style

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
- Add a new line after decleration
Tested by compilation.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 2703609..cad76ae 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
client, _client_fops);
if (!client->debug_root) {
char buf[256], *path;
+
path = dentry_path(dev->clients_debug_root, buf, 256);
pr_err("Failed to create client debugfs at %s/%s\n",
path, client->display_name);
-- 
1.9.3

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


[Patch V2 1/3] staging: android: ion: ion_dummy_driver.c Fix coding style

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
- Replace kzalloc() by kcalloc()
Tested by compilation.

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_dummy_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 3a45e79..6d0a38a 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
int i, err;
 
idev = ion_device_create(NULL);
-   heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+   heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
GFP_KERNEL);
if (!heaps)
return -ENOMEM;
-- 
1.9.3

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


[Patch V2 1/3] staging: android: ion: ion_dummy_driver.c Fix coding style

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
- Replace kzalloc() by kcalloc()
Tested by compilation.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_dummy_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 3a45e79..6d0a38a 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
int i, err;
 
idev = ion_device_create(NULL);
-   heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+   heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
GFP_KERNEL);
if (!heaps)
return -ENOMEM;
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch V2 2/3] staging: android: ion: ion.c Fix coding style

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
- Add a new line after decleration
Tested by compilation.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 2703609..cad76ae 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
client, debug_client_fops);
if (!client-debug_root) {
char buf[256], *path;
+
path = dentry_path(dev-clients_debug_root, buf, 256);
pr_err(Failed to create client debugfs at %s/%s\n,
path, client-display_name);
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch V2 3/3] staging: android: ion: Fix coding style

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
- Remove the return of void function
Tested by compilation.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion.c   | 1 -
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 drivers/staging/android/ion/ion_chunk_heap.c| 1 -
 drivers/staging/android/ion/ion_dummy_driver.c  | 2 --
 drivers/staging/android/ion/ion_system_heap.c   | 1 -
 5 files changed, 6 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index cad76ae..56604f4 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1057,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, 
unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
   void *ptr)
 {
-   return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index dcb6f21..9156d82 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct 
ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_chunk_heap.c 
b/drivers/staging/android/ion/ion_chunk_heap.c
index 9c3e49a..3e6ec2e 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct 
ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 6d0a38a..f3ea1c3 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
chunk_ptr = NULL;
}
-
-   return;
 }
 __exitcall(ion_dummy_exit);
diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 6b77c51..da2a63c 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct 
ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
  struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3 1/3] staging: android: ion: ion_dummy_driver.c Replace kzalloc() by kcalloc()

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_dummy_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 3a45e79..6d0a38a 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
int i, err;
 
idev = ion_device_create(NULL);
-   heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+   heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
GFP_KERNEL);
if (!heaps)
return -ENOMEM;
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3 3/3] staging: android: ion: Remove redundant return of void function

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion.c   | 1 -
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 drivers/staging/android/ion/ion_chunk_heap.c| 1 -
 drivers/staging/android/ion/ion_dummy_driver.c  | 2 --
 drivers/staging/android/ion/ion_system_heap.c   | 1 -
 5 files changed, 6 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index cad76ae..56604f4 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1057,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, 
unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
   void *ptr)
 {
-   return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index dcb6f21..9156d82 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct 
ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_chunk_heap.c 
b/drivers/staging/android/ion/ion_chunk_heap.c
index 9c3e49a..3e6ec2e 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct 
ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 6d0a38a..f3ea1c3 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
chunk_ptr = NULL;
}
-
-   return;
 }
 __exitcall(ion_dummy_exit);
diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 6b77c51..da2a63c 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct 
ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
  struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3 2/3] staging: android: ion: ion.c Add a new blank line after decleration

2014-08-13 Thread Phong Tran
This patch fix checkpatch.pl warning
Tested by compilation only.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 2703609..cad76ae 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
client, debug_client_fops);
if (!client-debug_root) {
char buf[256], *path;
+
path = dentry_path(dev-clients_debug_root, buf, 256);
pr_err(Failed to create client debugfs at %s/%s\n,
path, client-display_name);
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] staging: android: ion: ion.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix the coding style

- Add a new line after variable declaration
- Remove return of void fuction

Tested by compilation

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 2703609..56604f4 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
client, _client_fops);
if (!client->debug_root) {
char buf[256], *path;
+
path = dentry_path(dev->clients_debug_root, buf, 256);
pr_err("Failed to create client debugfs at %s/%s\n",
path, client->display_name);
@@ -1056,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, 
unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
   void *ptr)
 {
-   return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
-- 
1.9.3

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


[PATCH 4/5] staging: android: ion: ion_carveout_heap.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix coding style

- Remove return of void function

Tested by compilation

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index dcb6f21..9156d82 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct 
ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
-- 
1.9.3

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


[PATCH 3/5] staging: android: ion: ion_system_heap.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix coding rule

- Remove return of void function

Tested by compilation

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_system_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 6b77c51..da2a63c 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct 
ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
  struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
-- 
1.9.3

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


[PATCH 2/5] staging: android: ion: ion_chunk_heap.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix coding style

- Remove return of void function

Tested by compilation

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_chunk_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_chunk_heap.c 
b/drivers/staging/android/ion/ion_chunk_heap.c
index 9c3e49a..3e6ec2e 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct 
ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
-- 
1.9.3

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


[PATCH 5/5] staging: android: ion: ion_dummy_driver.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix coding style

- Replace kzalloc() by kcalloc()
- Remove return of void function

Tested by compilation

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_dummy_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 3a45e79..f3ea1c3 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
int i, err;
 
idev = ion_device_create(NULL);
-   heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+   heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
GFP_KERNEL);
if (!heaps)
return -ENOMEM;
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
chunk_ptr = NULL;
}
-
-   return;
 }
 __exitcall(ion_dummy_exit);
-- 
1.9.3

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


staging: android: ion checkpatch.pl cleanups

2014-08-12 Thread Phong Tran
Hi Greg,

These patches fix checkpatch warning.
Apply for staging-next branch.

Regards,
Phong.

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


staging: android: ion checkpatch.pl cleanups

2014-08-12 Thread Phong Tran
Hi Greg,

These patches fix checkpatch warning.
Apply for staging-next branch.

Regards,
Phong.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] staging: android: ion: ion_dummy_driver.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix coding style

- Replace kzalloc() by kcalloc()
- Remove return of void function

Tested by compilation

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_dummy_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion_dummy_driver.c 
b/drivers/staging/android/ion/ion_dummy_driver.c
index 3a45e79..f3ea1c3 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
int i, err;
 
idev = ion_device_create(NULL);
-   heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+   heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
GFP_KERNEL);
if (!heaps)
return -ENOMEM;
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
chunk_ptr = NULL;
}
-
-   return;
 }
 __exitcall(ion_dummy_exit);
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] staging: android: ion: ion_system_heap.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix coding rule

- Remove return of void function

Tested by compilation

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_system_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 6b77c51..da2a63c 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct 
ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
  struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] staging: android: ion: ion_carveout_heap.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix coding style

- Remove return of void function

Tested by compilation

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index dcb6f21..9156d82 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct 
ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] staging: android: ion: ion.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix the coding style

- Add a new line after variable declaration
- Remove return of void fuction

Tested by compilation

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 2703609..56604f4 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
client, debug_client_fops);
if (!client-debug_root) {
char buf[256], *path;
+
path = dentry_path(dev-clients_debug_root, buf, 256);
pr_err(Failed to create client debugfs at %s/%s\n,
path, client-display_name);
@@ -1056,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, 
unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
   void *ptr)
 {
-   return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] staging: android: ion: ion_chunk_heap.c Fix checkpatch warning

2014-08-12 Thread Phong Tran
This patch fix coding style

- Remove return of void function

Tested by compilation

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_chunk_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_chunk_heap.c 
b/drivers/staging/android/ion/ion_chunk_heap.c
index 9c3e49a..3e6ec2e 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct 
ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 struct ion_buffer *buffer)
 {
-   return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: android: ion: ion_cma_heap.c: Fix checkpatch warning

2014-07-19 Thread Phong Tran
This patch fix coding style:

- Remove "fail memory allocation" waring
- Remove return of void function

Tested by compilation only

Signed-off-by: Phong Tran 
---
 drivers/staging/android/ion/ion_cma_heap.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index ce68ecf..f8cabcb 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -76,10 +76,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
return -EINVAL;
 
info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
-   if (!info) {
-   dev_err(dev, "Can't allocate buffer info\n");
+   if (!info)
return ION_CMA_ALLOCATE_FAILED;
-   }
 
info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle),
GFP_HIGHUSER | __GFP_ZERO);
@@ -90,10 +88,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
}
 
info->table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
-   if (!info->table) {
-   dev_err(dev, "Fail to allocate sg table\n");
+   if (!info->table)
goto free_mem;
-   }
 
if (ion_cma_get_sgtable
(dev, info->table, info->cpu_addr, info->handle, len))
@@ -155,7 +151,6 @@ static struct sg_table *ion_cma_heap_map_dma(struct 
ion_heap *heap,
 static void ion_cma_heap_unmap_dma(struct ion_heap *heap,
   struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_cma_mmap(struct ion_heap *mapper, struct ion_buffer *buffer,
-- 
1.9.3

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


[PATCH] staging: android: ion: ion_cma_heap.c: Fix checkpatch warning

2014-07-19 Thread Phong Tran
This patch fix coding style:

- Remove fail memory allocation waring
- Remove return of void function

Tested by compilation only

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_cma_heap.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index ce68ecf..f8cabcb 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -76,10 +76,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
return -EINVAL;
 
info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
-   if (!info) {
-   dev_err(dev, Can't allocate buffer info\n);
+   if (!info)
return ION_CMA_ALLOCATE_FAILED;
-   }
 
info-cpu_addr = dma_alloc_coherent(dev, len, (info-handle),
GFP_HIGHUSER | __GFP_ZERO);
@@ -90,10 +88,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
}
 
info-table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
-   if (!info-table) {
-   dev_err(dev, Fail to allocate sg table\n);
+   if (!info-table)
goto free_mem;
-   }
 
if (ion_cma_get_sgtable
(dev, info-table, info-cpu_addr, info-handle, len))
@@ -155,7 +151,6 @@ static struct sg_table *ion_cma_heap_map_dma(struct 
ion_heap *heap,
 static void ion_cma_heap_unmap_dma(struct ion_heap *heap,
   struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_cma_mmap(struct ion_heap *mapper, struct ion_buffer *buffer,
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/