Re: [PATCH] staging: most: protect potential string overflow

2019-04-25 Thread Bo YU
On Wed, Apr 24, 2019 at 10:55 PM Dan Carpenter  wrote:
>
> On Mon, Apr 22, 2019 at 10:20:18PM -0400, Bo YU wrote:
> > There maybe cause potential string overflow issue due to use
> > strcpy without checking the length
> >
> > Detected By CoversityScan CID# 1444760
> >
> > Fixes: 131ac62253dba:(staging: most: core: use device description as name)
>
> It doesn't really fix anything, it just silences a static checker
> warning.
>
> > Signed-off-by: Bo YU 
> > ---
> >  drivers/staging/most/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
> > index 956daf8c3bd2..0f26cebac91a 100644
> > --- a/drivers/staging/most/core.c
> > +++ b/drivers/staging/most/core.c
> > @@ -1431,7 +1431,7 @@ int most_register_interface(struct most_interface 
> > *iface)
> >
> >   INIT_LIST_HEAD(&iface->p->channel_list);
> >   iface->p->dev_id = id;
> > - strcpy(iface->p->name, iface->description);
> > + strlcpy(iface->p->name, iface->description, sizeof(iface->p->name));
>
> We prefer strscpy() more than strlcpy() these days.

 Ok,will try it.
 Thanks,

>
> regards,
> dan carpenter
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: most: protect potential string overflow

2019-04-22 Thread Bo YU
There maybe cause potential string overflow issue due to use
strcpy without checking the length

Detected By CoversityScan CID# 1444760

Fixes: 131ac62253dba:(staging: most: core: use device description as name)
Signed-off-by: Bo YU 
---
 drivers/staging/most/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 956daf8c3bd2..0f26cebac91a 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -1431,7 +1431,7 @@ int most_register_interface(struct most_interface *iface)
 
INIT_LIST_HEAD(&iface->p->channel_list);
iface->p->dev_id = id;
-   strcpy(iface->p->name, iface->description);
+   strlcpy(iface->p->name, iface->description, sizeof(iface->p->name));
iface->dev.init_name = iface->p->name;
iface->dev.bus = &mc.bus;
iface->dev.parent = &mc.dev;
-- 
2.11.0

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


[PATCH V2] staging: wilc1000: fix incorrent type in initializer

2019-02-27 Thread Bo YU
Fix sparse warning:

drivers/staging/wilc1000//host_interface.c:444:49: warning: incorrect type in 
initializer (different address spaces)
drivers/staging/wilc1000//host_interface.c:444:49:expected struct 
cfg80211_bss_ies const *ies
drivers/staging/wilc1000//host_interface.c:444:49:got struct 
cfg80211_bss_ies const [noderef]  *ies

Signed-off-by: Bo YU 
---
V2: Adding cc wireless-list
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 20349af2ed30..4dd9a20f6a0b 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -441,7 +441,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss,
const u8 *tim_elm, *ssid_elm, *rates_ie, *supp_rates_ie;
const u8 *ht_ie, *wpa_ie, *wmm_ie, *rsn_ie;
int ret;
-   const struct cfg80211_bss_ies *ies = bss->ies;
+   const struct cfg80211_bss_ies *ies = rcu_dereference(bss->ies);
 
param = kzalloc(sizeof(*param), GFP_KERNEL);
if (!param)
-- 
2.11.0

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


[PATCH V2] staging: wilc1000: fix incorrent type assignment

2019-02-25 Thread Bo YU
Fix sparse warning:

drivers/staging/wilc1000/host_interface.c:450:30: warning: incorrect type in 
assignment (different base types)
drivers/staging/wilc1000/host_interface.c:450:30:expected restricted __le16 
[usertype] beacon_period
drivers/staging/wilc1000/host_interface.c:450:30:got unsigned short 
[usertype] beacon_interval
drivers/staging/wilc1000/host_interface.c:451:25: warning: incorrect type in 
assignment (different base types)
drivers/staging/wilc1000/host_interface.c:451:25:expected restricted __le16 
[usertype] cap_info
drivers/staging/wilc1000/host_interface.c:451:25:got unsigned short 
[usertype] capability

Signed-off-by: Bo YU 
---
V2: use cpu_to_le16 assign valid type according to Ajay's suggestions
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 50dc2dd942f5..20349af2ed30 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -447,8 +447,8 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss,
if (!param)
return NULL;
 
-   param->beacon_period = bss->beacon_interval;
-   param->cap_info = bss->capability;
+   param->beacon_period = cpu_to_le16(bss->beacon_interval);
+   param->cap_info = cpu_to_le16(bss->capability);
param->bss_type = WILC_FW_BSS_TYPE_INFRA;
param->ch = ieee80211_frequency_to_channel(bss->channel->center_freq);
ether_addr_copy(param->bssid, bss->bssid);
-- 
2.11.0

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


[PATCH] staging: wilc1000: fix incorrect type in initializer

2019-02-25 Thread Bo YU
Fix sparse warning following:

drivers/staging/wilc1000/host_interface.c:444:49: warning: incorrect type in 
initializer (different address spaces)
drivers/staging/wilc1000/host_interface.c:444:49:expected struct 
cfg80211_bss_ies const *ies
drivers/staging/wilc1000/host_interface.c:444:49:got struct 
cfg80211_bss_ies const [noderef]  *ies

Signed-off-by: Bo YU 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index cdcb52aec779..89ae22d40f71 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -441,7 +441,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss,
const u8 *tim_elm, *ssid_elm, *rates_ie, *supp_rates_ie;
const u8 *ht_ie, *wpa_ie, *wmm_ie, *rsn_ie;
int ret;
-   const struct cfg80211_bss_ies *ies = bss->ies;
+   const struct cfg80211_bss_ies *ies = rcu_dereference(bss->ies);
 
param = kzalloc(sizeof(*param), GFP_KERNEL);
if (!param)
-- 
2.11.0

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


[PATCH] staging: wilc1000: Fix incorrent type in assignment

2019-02-25 Thread Bo YU
The patch fixes following sparse warning:

drivers/staging/wilc1000/host_interface.c:450:30: warning: incorrect type in 
assignment (different base types)
drivers/staging/wilc1000/host_interface.c:450:30:expected restricted __le16 
[usertype] beacon_period
drivers/staging/wilc1000/host_interface.c:450:30:got unsigned short 
[usertype] beacon_interval
drivers/staging/wilc1000/host_interface.c:451:25: warning: incorrect type in 
assignment (different base types)
drivers/staging/wilc1000/host_interface.c:451:25:expected restricted __le16 
[usertype] cap_info
drivers/staging/wilc1000/host_interface.c:451:25:got unsigned short 
[usertype] capability

Signed-off-by: Bo YU 
---
I have no hardware to test it and just to compile it
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 50dc2dd942f5..cdcb52aec779 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -106,10 +106,10 @@ struct wilc_join_bss_param {
u8 ssid_terminator;
u8 bss_type;
u8 ch;
-   __le16 cap_info;
+   u16 cap_info;
u8 sa[ETH_ALEN];
u8 bssid[ETH_ALEN];
-   __le16 beacon_period;
+   u16 beacon_period;
u8 dtim_period;
u8 supp_rates[WILC_MAX_RATES_SUPPORTED + 1];
u8 wmm_cap;
-- 
2.11.0

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


[PATCH V3] staging: ks7010: removed unused variables

2019-02-22 Thread Bo YU
From: Bo Yu 

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’
set but not used [-Wunused-but-set-variable]
  u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’
set but not used [-Wunused-but-set-variable]
u16 mib_val_size;

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’
set but not used [-Wunused-but-set-variable]
  u16 result_code;

Remove these variables.

Cc: Greg Kroah-Hartman 
Cc: Sergio Paracuellos 
Cc: Quytelda Kahja 

Signed-off-by: Bo Yu 
---
Changelog:
V3: fix spell issue in subject line
V2: fix patch format
---
 drivers/staging/ks7010/ks_hostif.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index d938b0997a53..913d8996437a 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -461,13 +461,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
struct net_device *dev = priv->net_dev;
u32 mib_status;
u32 mib_attribute;
-   u16 mib_val_size;
-   u16 mib_val_type;
 
mib_status = get_dword(priv);
mib_attribute = get_dword(priv);
-   mib_val_size = get_word(priv);
-   mib_val_type = get_word(priv);
 
if (mib_status) {
netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -783,9 +779,7 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private 
*priv)
 static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
-   u16 result_code;
 
-   result_code = get_word(priv);
priv->infra_status = 1; /* infrastructure mode set */
hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
 }
-- 
2.11.0

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


[PATCH V2] staging: ks7070: removed unused varibales

2019-02-22 Thread Bo YU
From: Bo Yu 

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’
set but not used [-Wunused-but-set-variable]
  u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’
set but not used [-Wunused-but-set-variable]
u16 mib_val_size;

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’
set but not used [-Wunused-but-set-variable]
  u16 result_code;

Remove these variables.

Rebase on next-20190222

V2: fix patch format

Cc: Greg Kroah-Hartman 
Cc: Sergio Paracuellos 
Cc: Quytelda Kahja 

Signed-off-by: Bo Yu 
---
 drivers/staging/ks7010/ks_hostif.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index d938b0997a53..913d8996437a 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -461,13 +461,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
struct net_device *dev = priv->net_dev;
u32 mib_status;
u32 mib_attribute;
-   u16 mib_val_size;
-   u16 mib_val_type;
 
mib_status = get_dword(priv);
mib_attribute = get_dword(priv);
-   mib_val_size = get_word(priv);
-   mib_val_type = get_word(priv);
 
if (mib_status) {
netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -783,9 +779,7 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private 
*priv)
 static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
-   u16 result_code;
 
-   result_code = get_word(priv);
priv->infra_status = 1; /* infrastructure mode set */
hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
 }
-- 
2.11.0

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


[PATCH] staging/ks7070: Removed unused varibale

2019-02-22 Thread Bo YU
From: Bo Yu 

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’
set but not used [-Wunused-but-set-variable]
  u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’
set but not used [-Wunused-but-set-variable]
u16 mib_val_size;

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’
set but not used [-Wunused-but-set-variable]
  u16 result_code;

Remove these variables.

Rebase on next-20190222

Cc: Greg Kroah-Hartman 
Cc: Sergio Paracuellos 
Cc: Quytelda Kahja 

Signed-off-by: Bo Yu 
---
 drivers/staging/ks7010/ks_hostif.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index d938b0997a53..913d8996437a 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -461,13 +461,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
struct net_device *dev = priv->net_dev;
u32 mib_status;
u32 mib_attribute;
-   u16 mib_val_size;
-   u16 mib_val_type;
 
mib_status = get_dword(priv);
mib_attribute = get_dword(priv);
-   mib_val_size = get_word(priv);
-   mib_val_type = get_word(priv);
 
if (mib_status) {
netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -783,9 +779,7 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private 
*priv)
 static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
-   u16 result_code;
 
-   result_code = get_word(priv);
priv->infra_status = 1; /* infrastructure mode set */
hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
 }
-- 
2.11.0

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


[PATCH] staging/erofs: fix sparse's warnings on undeclared symbols in erofs

2019-02-21 Thread Bo YU
From: Bo Yu 

Fix sparse warnings:

drivers/staging/erofs/utils.c:134:6: warning: symbol
'erofs_try_to_release_workgroup' was not declared. Should it be static?

Fixes: 51232df5e4b26("staging: erofs: fix race when the managed cache is 
enabled")
Cc: Gao Xiang 
Cc: Chao Yu 
CC: Greg Kroah-Hartman 
Signed-off-by: Bo Yu 
---
 drivers/staging/erofs/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/erofs/utils.c b/drivers/staging/erofs/utils.c
index b535898ca753..33cd5ad55cb8 100644
--- a/drivers/staging/erofs/utils.c
+++ b/drivers/staging/erofs/utils.c
@@ -131,7 +131,7 @@ static void erofs_workgroup_unfreeze_final(struct 
erofs_workgroup *grp)
__erofs_workgroup_free(grp);
 }
 
-bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
+static bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
struct erofs_workgroup *grp,
bool cleanup)
 {
-- 
2.11.0

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


[PATCH 3/4] staging: speakup: in serialio.c no over 80 chars long

2017-06-05 Thread Bo YU
Fixed the checkpatch.pl warning:

WARNING: line over 80 characters

Signed-off-by: Bo YU 
---
 drivers/staging/speakup/serialio.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/serialio.c 
b/drivers/staging/speakup/serialio.c
index f38eb66943bf..00b25d3591d2 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -228,7 +228,8 @@ int spk_wait_for_xmitr(struct spk_synth *in_synth)
}
while (spk_serial_tx_busy()) {
if (--tmout == 0) {
-   pr_warn("%s: timed out (tx busy)\n", 
in_synth->long_name);
+   pr_warn("%s: timed out (tx busy)\n",
+   in_synth->long_name);
timeouts++;
return 0;
}
@@ -285,7 +286,8 @@ static int spk_serial_out(struct spk_synth *in_synth, const 
char ch)
return 0;
 }
 
-const char *spk_serial_synth_immediate(struct spk_synth *synth, const char 
*buff)
+const char *spk_serial_synth_immediate(struct spk_synth *synth,
+  const char *buff)
 {
u_char ch;
 
-- 
1.7.10.4

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


[PATCH 4/4] staging: speakup: alignment match open parens

2017-06-05 Thread Bo YU
I have aligned argument with parenthesis, so checkpatch no check also.

Signed-off-by: Bo YU 
---
 drivers/staging/speakup/serialio.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/serialio.c 
b/drivers/staging/speakup/serialio.c
index 00b25d3591d2..9cfc8142a318 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -139,7 +139,7 @@ static void start_serial_interrupt(int irq)
 speakup_info.port_tts + UART_MCR);
/* Turn on Interrupts */
outb(UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI,
-   speakup_info.port_tts + UART_IER);
+speakup_info.port_tts + UART_IER);
inb(speakup_info.port_tts + UART_LSR);
inb(speakup_info.port_tts + UART_RX);
inb(speakup_info.port_tts + UART_IIR);
-- 
1.7.10.4

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


[PATCH 2/4] staging: speakup: add a space around '|'

2017-06-05 Thread Bo YU
Add a space around logical symbol '|' to wipe out checkpatch check

Signed-off-by: Bo YU 
---
 drivers/staging/speakup/serialio.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/serialio.c 
b/drivers/staging/speakup/serialio.c
index 8d2f7c672cc6..f38eb66943bf 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -138,7 +138,7 @@ static void start_serial_interrupt(int irq)
outb(UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2,
 speakup_info.port_tts + UART_MCR);
/* Turn on Interrupts */
-   outb(UART_IER_MSI|UART_IER_RLSI|UART_IER_RDI,
+   outb(UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI,
speakup_info.port_tts + UART_IER);
inb(speakup_info.port_tts + UART_LSR);
inb(speakup_info.port_tts + UART_RX);
-- 
1.7.10.4

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


[PATCH 1/4] staging: speakup: add a missing blank line after declaration

2017-06-05 Thread Bo YU
Fixed checkpatch warning by adding a blank line after declare
expression

Signed-off-by: Bo YU 
---
 drivers/staging/speakup/serialio.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/speakup/serialio.c 
b/drivers/staging/speakup/serialio.c
index 969373201356..8d2f7c672cc6 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -162,6 +162,7 @@ static void spk_serial_send_xchar(char ch)
 static void spk_serial_tiocmset(unsigned int set, unsigned int clear)
 {
int old = inb(speakup_info.port_tts + UART_MCR);
+
outb((old & ~clear) | set, speakup_info.port_tts + UART_MCR);
 }
 
-- 
1.7.10.4

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


[PATCH 0/4] staging: speakup: fix code style

2017-06-05 Thread Bo YU
As checkpatch.pl reported, i fixed these complaint one by one. Maybe
patch 04 depend on patch 02.

Thanks!

Bo YU (4):
  staging: speakup: add a missing blank line after declaration
  staging: speakup: add a space around '|'
  staging: speakup: in serialio.c no over 80 chars long
  staging: speakup: alignment match open parens

 drivers/staging/speakup/serialio.c |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

--
1.7.10.4

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


[PATCH] Staging: iio: return expression instead of return ret

2017-03-09 Thread Bo Yu

The following Coccinelle script was used to detect this:

@@
local idexpression ret;
expression e;
@@

-ret =
+return
  e;
-return ret;

Signed-off-by: Bo YU 
---
  drivers/staging/iio/meter/ade7754.c |3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7754.c 
b/drivers/staging/iio/meter/ade7754.c
index 024463a11c47..19f8cb144768 100644
--- a/drivers/staging/iio/meter/ade7754.c
+++ b/drivers/staging/iio/meter/ade7754.c
@@ -349,9 +349,8 @@ static int ade7754_set_irq(struct device *dev, bool enable)
else
irqen &= ~BIT(14);

-   ret = ade7754_spi_write_reg_16(dev, ADE7754_IRQEN, irqen);
+   return ade7754_spi_write_reg_16(dev, ADE7754_IRQEN, irqen);

-   return ret;
  }

  /* Power down the device */
--
1.7.10.4

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


[PATCH v2] Staging: wlan-ng: fixed block comments should align the * on each line

2017-02-17 Thread Bo YU

Right-shift a space key to align the * on each line.

Signed-off-by: Bo YU 
---
 drivers/staging/wlan-ng/p80211metastruct.h |   88 ++--
 1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211metastruct.h 
b/drivers/staging/wlan-ng/p80211metastruct.h
index 850d897fc163..c2ffec4daa90 100644
--- a/drivers/staging/wlan-ng/p80211metastruct.h
+++ b/drivers/staging/wlan-ng/p80211metastruct.h
@@ -1,48 +1,48 @@
 /* This file is GENERATED AUTOMATICALLY.  DO NOT EDIT OR MODIFY.
-* 
-*
-* Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
-* 
-*
-* linux-wlan
-*
-*   The contents of this file are subject to the Mozilla Public
-*   License Version 1.1 (the "License"); you may not use this file
-*   except in compliance with the License. You may obtain a copy of
-*   the License at http://www.mozilla.org/MPL/
-*
-*   Software distributed under the License is distributed on an "AS
-*   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-*   implied. See the License for the specific language governing
-*   rights and limitations under the License.
-*
-*   Alternatively, the contents of this file may be used under the
-*   terms of the GNU Public License version 2 (the "GPL"), in which
-*   case the provisions of the GPL are applicable instead of the
-*   above.  If you wish to allow the use of your version of this file
-*   only under the terms of the GPL and not to allow others to use
-*   your version of this file under the MPL, indicate your decision
-*   by deleting the provisions above and replace them with the notice
-*   and other provisions required by the GPL.  If you do not delete
-*   the provisions above, a recipient may use your version of this
-*   file under either the MPL or the GPL.
-*
-* 
-*
-* Inquiries regarding the linux-wlan Open Source project can be
-* made directly to:
-*
-* AbsoluteValue Systems Inc.
-* i...@linux-wlan.com
-* http://www.linux-wlan.com
-*
-* 
-*
-* Portions of the development of this software were funded by
-* Intersil Corporation as part of PRISM(R) chipset product development.
-*
-* 
-*/
+ * 
+ *
+ * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
+ * 
+ *
+ * linux-wlan
+ *
+ *   The contents of this file are subject to the Mozilla Public
+ *   License Version 1.1 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.mozilla.org/MPL/
+ *
+ *   Software distributed under the License is distributed on an "AS
+ *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ *   implied. See the License for the specific language governing
+ *   rights and limitations under the License.
+ *
+ *   Alternatively, the contents of this file may be used under the
+ *   terms of the GNU Public License version 2 (the "GPL"), in which
+ *   case the provisions of the GPL are applicable instead of the
+ *   above.  If you wish to allow the use of your version of this file
+ *   only under the terms of the GPL and not to allow others to use
+ *   your version of this file under the MPL, indicate your decision
+ *   by deleting the provisions above and replace them with the notice
+ *   and other provisions required by the GPL.  If you do not delete
+ *   the provisions above, a recipient may use your version of this
+ *   file under either the MPL or the GPL.
+ *
+ * 
+ *
+ * Inquiries regarding the linux-wlan Open Source project can be
+ * made directly to:
+ *
+ * AbsoluteValue Systems Inc.
+ * i...@linux-wlan.com
+ * http://www.linux-wlan.com
+ *
+ * 
+ *
+ * Portions of the development of this software were funded by
+ * Intersil Corporation as part of PRISM(R) chipset product development.
+ *
+ * 
+ */

 #ifndef _P80211MKMETASTRUCT_H
 #define _P80211MKMETASTRUCT_H
--
1.7.10.4

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


[PATCH] Staging: bcm2835-audio: fixed a code style issue:

2017-02-16 Thread Bo YU

Missing a blank line after declarations

Signed-off-by: Bo YU 
---
 drivers/staging/bcm2835-audio/bcm2835-pcm.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/bcm2835-audio/bcm2835-pcm.c 
b/drivers/staging/bcm2835-audio/bcm2835-pcm.c
index 014bf7ab69f4..16127e062661 100644
--- a/drivers/staging/bcm2835-audio/bcm2835-pcm.c
+++ b/drivers/staging/bcm2835-audio/bcm2835-pcm.c
@@ -450,6 +450,7 @@ static int snd_bcm2835_pcm_lib_ioctl(struct 
snd_pcm_substream *substream,
unsigned int cmd, void *arg)
 {
int ret = snd_pcm_lib_ioctl(substream, cmd, arg);
+
audio_info(" .. substream=%p, cmd=%d, arg=%p (%x) ret=%d\n", substream,
cmd, arg, arg ? *(unsigned *) arg : 0, ret);
return ret;
--
1.7.10.4

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


[PATCH] Staging: wlan-ng: Fixed the code style issue:

2017-02-14 Thread Bo YU

WARNING: Block comments should align the * on each line

Signed-off-by: Bo YU 
---
 drivers/staging/wlan-ng/p80211metastruct.h |   88 ++--
 1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211metastruct.h 
b/drivers/staging/wlan-ng/p80211metastruct.h
index 850d897fc163..c2ffec4daa90 100644
--- a/drivers/staging/wlan-ng/p80211metastruct.h
+++ b/drivers/staging/wlan-ng/p80211metastruct.h
@@ -1,48 +1,48 @@
 /* This file is GENERATED AUTOMATICALLY.  DO NOT EDIT OR MODIFY.
-* 
-*
-* Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
-* 
-*
-* linux-wlan
-*
-*   The contents of this file are subject to the Mozilla Public
-*   License Version 1.1 (the "License"); you may not use this file
-*   except in compliance with the License. You may obtain a copy of
-*   the License at http://www.mozilla.org/MPL/
-*
-*   Software distributed under the License is distributed on an "AS
-*   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-*   implied. See the License for the specific language governing
-*   rights and limitations under the License.
-*
-*   Alternatively, the contents of this file may be used under the
-*   terms of the GNU Public License version 2 (the "GPL"), in which
-*   case the provisions of the GPL are applicable instead of the
-*   above.  If you wish to allow the use of your version of this file
-*   only under the terms of the GPL and not to allow others to use
-*   your version of this file under the MPL, indicate your decision
-*   by deleting the provisions above and replace them with the notice
-*   and other provisions required by the GPL.  If you do not delete
-*   the provisions above, a recipient may use your version of this
-*   file under either the MPL or the GPL.
-*
-* 
-*
-* Inquiries regarding the linux-wlan Open Source project can be
-* made directly to:
-*
-* AbsoluteValue Systems Inc.
-* i...@linux-wlan.com
-* http://www.linux-wlan.com
-*
-* 
-*
-* Portions of the development of this software were funded by
-* Intersil Corporation as part of PRISM(R) chipset product development.
-*
-* 
-*/
+ * 
+ *
+ * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
+ * 
+ *
+ * linux-wlan
+ *
+ *   The contents of this file are subject to the Mozilla Public
+ *   License Version 1.1 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.mozilla.org/MPL/
+ *
+ *   Software distributed under the License is distributed on an "AS
+ *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ *   implied. See the License for the specific language governing
+ *   rights and limitations under the License.
+ *
+ *   Alternatively, the contents of this file may be used under the
+ *   terms of the GNU Public License version 2 (the "GPL"), in which
+ *   case the provisions of the GPL are applicable instead of the
+ *   above.  If you wish to allow the use of your version of this file
+ *   only under the terms of the GPL and not to allow others to use
+ *   your version of this file under the MPL, indicate your decision
+ *   by deleting the provisions above and replace them with the notice
+ *   and other provisions required by the GPL.  If you do not delete
+ *   the provisions above, a recipient may use your version of this
+ *   file under either the MPL or the GPL.
+ *
+ * 
+ *
+ * Inquiries regarding the linux-wlan Open Source project can be
+ * made directly to:
+ *
+ * AbsoluteValue Systems Inc.
+ * i...@linux-wlan.com
+ * http://www.linux-wlan.com
+ *
+ * 
+ *
+ * Portions of the development of this software were funded by
+ * Intersil Corporation as part of PRISM(R) chipset product development.
+ *
+ * 
+ */

 #ifndef _P80211MKMETASTRUCT_H
 #define _P80211MKMETASTRUCT_H
--
1.7.10.4

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


[PATCH] Staging: wlan-ng: Fixed code style issue:

2017-02-13 Thread Bo YU

Statements should start on a tabstop

Signed-off-by: YU Bo 
---
 drivers/staging/wlan-ng/prism2mgmt.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2mgmt.c 
b/drivers/staging/wlan-ng/prism2mgmt.c
index c558ad656c49..b641a59052ac 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -1307,8 +1307,7 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, void 
*msgp)
&& (msg->prismheader.data == P80211ENUM_truth_true)) {
hw->sniffhdr = 0;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
-   } else
-   if ((msg->wlanheader.status ==
+   } else if ((msg->wlanheader.status ==
 P80211ENUM_msgitem_status_data_ok)
&& (msg->wlanheader.data == P80211ENUM_truth_true)) {
hw->sniffhdr = 1;
--
1.7.10.4

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


Re: [PATCH] staging: xgifb: Fix comment style

2016-03-22 Thread Bo Yu

On Mon, Mar 21, 2016 at 03:38:21PM -0400, Kroah-Hartman wrote:
hi,

On Sat, Mar 12, 2016 at 03:40:35AM -0500, YU Bo wrote:

Fix comments to use trailing */ on separste lines.

Signed-off-by: YU BO 
---
drivers/staging/xgifb/vb_init.c|3 ++-
drivers/staging/xgifb/vb_setmode.c |3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)


You sent me 2 different patches with the identical subject: line, which
I can't accept.  Please fix them up and send a patch series, with unique
subjects.

yes, you are right:) I will fix them up and resend a patch series.
Sorry for the noise.
Thanks.


thanks,

greg k-h

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


Re: [PATCH] staging: xgifb: Fix comment style

2016-02-22 Thread Bo YU
Oh,
I am miss ccing list in previous email.


On Sun, Feb 21, 2016 at 8:57 PM, Roger H Newell  wrote:
> Hello:
>
> I think you need to make sure your staging-testing tree is current
> before creating a patch.
>
> git checkout staging-testing && git fetch origin
> git checkout my-branch && git rebase origin/staging-testing
>
> As I understand it any patch you create after those commands will be
> on-top of the current state of Gregs tree and should apply.
>
I have done that creating a patch   as you tell me the same.But Gerg
reply to tell
me as if my git configure that have problems.

When i run ` git am patch` it reports errors.There is a problem

Thanks a lot.
> Regards:
> Roger H. Newell
>
> On Sun, Feb 21, 2016 at 5:29 AM, Bo YU  wrote:
>> Hello,
>>
>> On Sat, Feb 20, 2016 at 03:38:15PM -0800, Kroah-Hartman wrote:
>>>On Wed, Feb 17, 2016 at 02:53:34PM +0800, Bo YU wrote:
>>>> Fix comments to use trailing */ on separate lines.
>>>>
>>>> Signed-off-by: YU BO 
>>>> ---
>>>>   drivers/staging/xgifb/vb_init.c |   10 +-
>>>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>>Patch doesn't apply :(
>> I don't know that whether i am doing wrong something with git.
>> Because when i run `git am the-codingfixed-patch` ,it reports error.
>> But run `patch -p1 the-codingfixed-patch` it is ok.
>>
>> Perhaps i am wrong with others.
>>
>> Could you tell me a little hit?
>>
>> Sorry for the noisy.:)
>> --
>> Best Regards
>> ___
>> devel mailing list
>> de...@linuxdriverproject.org
>> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: xgifb: Fix comment style

2016-02-21 Thread Bo YU
Hi,
On Sun, Feb 21, 2016 at 11:33:48AM -0800, Kroah-Hartman wrote:
>On Sun, Feb 21, 2016 at 04:59:17PM +0800, Bo YU wrote:
>> Hello,
>>
>> On Sat, Feb 20, 2016 at 03:38:15PM -0800, Kroah-Hartman wrote:

>> >Patch doesn't apply :(
>> I don't know that whether i am doing wrong something with git.
>> Because when i run `git am the-codingfixed-patch` ,it reports error.
>
>Yes, that is the problem, please work on fixing that.  I don't have the
>time to determine exactly what the error is, sorry.
>
I will fix that :)
Thanks a lot for your patience and help.
>greg k-h

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


Re: [PATCH] staging: xgifb: Fix comment style

2016-02-21 Thread Bo YU
Hello,

On Sat, Feb 20, 2016 at 03:38:15PM -0800, Kroah-Hartman wrote:
>On Wed, Feb 17, 2016 at 02:53:34PM +0800, Bo YU wrote:
>> Fix comments to use trailing */ on separate lines.
>>
>> Signed-off-by: YU BO 
>> ---
>>   drivers/staging/xgifb/vb_init.c |   10 +-
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>
>Patch doesn't apply :(
I don't know that whether i am doing wrong something with git.
Because when i run `git am the-codingfixed-patch` ,it reports error.
But run `patch -p1 the-codingfixed-patch` it is ok.

Perhaps i am wrong with others.

Could you tell me a little hit?

Sorry for the noisy.:)
--
Best Regards
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: xgifb: Fix comment style

2016-02-16 Thread Bo YU
Fix comments to use trailing */ on separate lines.

Signed-off-by: YU BO 
---
  drivers/staging/xgifb/vb_init.c |   10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 26b539b..c7f02c7 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -699,11 +699,11 @@ static void XGINew_CheckChannel(struct
xgi_hw_device_info *HwDeviceExtension,
  break;
  case XG42:
  /*
- XG42 SR14 D[3] Reserve
- D[2] = 1, Dual Channel
- = 0, Single Channel
-
- It's Different from Other XG40 Series.
+ * XG42 SR14 D[3] Reserve
+ * D[2] = 1, Dual Channel
+ * = 0, Single Channel
+ *
+ * It's Different from Other XG40 Series.
  */
  if (XGINew_CheckFrequence(pVBInfo) == 1) { /* DDRII, DDR2x */
  pVBInfo->ram_bus = 32; /* 32 bits */
--
1.7.10.4


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


Re: [PATCH] Staging: xgifb: vgatypes.h: Coding style warning fix for block comments

2016-02-15 Thread Bo YU
Hi,

Sorry for the delay to reply.I have send the patch to Arnaud,but he
didn't reply me...Maybe i was wrong with something.

Thanks again.

On Mon, Feb 8, 2016 at 12:14 PM, Kroah-Hartman
 wrote:
> On Fri, Jan 15, 2016 at 05:30:02PM +0800, YU Bo wrote:
>> This patch is to vgatypes.h file that fixes up following warnings
>> reported by checkpatch.pl tool
>>
>> Signed-off-by: YU Bo 
>> ---
>>  drivers/staging/xgifb/vgatypes.h |   12 
>>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> None of your patches applied, are you sure you are sending them
> properly?
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: comedi: fix more characters coding style issue in comedi_pcmcia.h

2016-01-13 Thread Bo YU
This is a patch to the comedi_pcmcia.h file that fixes up a "line over
80 characters" warning  found by the checkpatch.pl tool

Signed-off-by: YU Bo 
---
  drivers/staging/comedi/comedi_pcmcia.h |3 ++-
  1 个文件被修改,插入 2 行(+),删除 1 行(-)

diff --git a/drivers/staging/comedi/comedi_pcmcia.h
b/drivers/staging/comedi/comedi_pcmcia.h
index 5d3db2b..3d076e7 100644
--- a/drivers/staging/comedi/comedi_pcmcia.h
+++ b/drivers/staging/comedi/comedi_pcmcia.h
@@ -39,7 +39,8 @@ void comedi_pcmcia_driver_unregister(struct comedi_driver *,
  struct pcmcia_driver *);

  /**
- * module_comedi_pcmcia_driver() - Helper macro for registering a
comedi PCMCIA driver
+ * module_comedi_pcmcia_driver() - Helper
+ * macro for registering a comedi PCMCIA driver
   * @__comedi_driver: comedi_driver struct
   * @__pcmcia_driver: pcmcia_driver struct
   *
--
1.7.10.4


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


[PATCH] Staging: comedi: fix coding style issue in comedilib.h

2016-01-13 Thread Bo YU
This is a patch to the comedilib.h file that fixes "bloch comment use
* on subsequent lines" warning found by the checkpatch.pl tool

Signed-off-by: YU Bo 
---
  drivers/staging/comedi/comedilib.h |   32 
  1 个文件被修改,插入 16 行(+),删除 16 行(-)

diff --git a/drivers/staging/comedi/comedilib.h
b/drivers/staging/comedi/comedilib.h
index 56baf85..5f0ecc5 100644
--- a/drivers/staging/comedi/comedilib.h
+++ b/drivers/staging/comedi/comedilib.h
@@ -1,20 +1,20 @@
  /*
-linux/include/comedilib.h
-header file for kcomedilib
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1998-2001 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ *linux/include/comedilib.h
+ *   header file for kcomedilib
+ *
+ *   COMEDI - Linux Control and Measurement Device Interface
+ *Copyright (C) 1998-2001 David A. Schleef 
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ */

  #ifndef _LINUX_COMEDILIB_H
  #define _LINUX_COMEDILIB_H
--
1.7.10.4


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