Re: [PATCH] staging: mt7621-pinctrl: fix uninitialized variable ngroups
On Sat, Nov 10, 2018 at 11:28:06PM +, Colin King wrote: > From: Colin Ian King > > Currently the for_each_node_with_property loop us incrementing variable > ngroups however it was not initialized and hence will contain garbage. > Fix this by initializing ngroups to zero. > > Detected with static analysis with cppcheck: > > drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c:89]: (error) Uninitialized > variable: ngroups > > Fixes: e12a1a6e087b ("staging: mt7621-pinctrl: refactor > rt2880_pinctrl_dt_node_to_map function") > Signed-off-by: Colin Ian King > --- > drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c > b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c > index b8566ed898f1..aa98fbb17013 100644 > --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c > +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c > @@ -82,7 +82,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev > *pctrldev, > struct property *prop; > const char *function_name, *group_name; > int ret; > - int ngroups; > + int ngroups = 0; > unsigned int reserved_maps = 0; > > for_each_node_with_property(np_config, "group") > -- > 2.19.1 > Thanks, Colin. Looks good. Reviewed-by: Sergio Paracuellos Best regards, Sergio Paracuellos ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface
Use the gpiod interface instead of the deprecated old non-descriptor interface. Signed-off-by: Nishad Kamdar --- drivers/staging/greybus/arche-apb-ctrl.c | 158 ++- 1 file changed, 65 insertions(+), 93 deletions(-) diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c index cc8d6fc831b4..fd19e2394c9c 100644 --- a/drivers/staging/greybus/arche-apb-ctrl.c +++ b/drivers/staging/greybus/arche-apb-ctrl.c @@ -8,9 +8,8 @@ #include #include -#include +#include #include -#include #include #include #include @@ -20,17 +19,16 @@ #include #include "arche_platform.h" - static void apb_bootret_deassert(struct device *dev); struct arche_apb_ctrl_drvdata { /* Control GPIO signals to and from AP <=> AP Bridges */ - int resetn_gpio; - int boot_ret_gpio; - int pwroff_gpio; - int wake_in_gpio; - int wake_out_gpio; - int pwrdn_gpio; + struct gpio_desc *resetn; + struct gpio_desc *boot_ret; + struct gpio_desc *pwroff; + struct gpio_desc *wake_in; + struct gpio_desc *wake_out; + struct gpio_desc *pwrdn; enum arche_platform_state state; bool init_disabled; @@ -38,28 +36,28 @@ struct arche_apb_ctrl_drvdata { struct regulator *vcore; struct regulator *vio; - int clk_en_gpio; + struct gpio_desc *clk_en; struct clk *clk; struct pinctrl *pinctrl; struct pinctrl_state *pin_default; /* V2: SPI Bus control */ - int spi_en_gpio; + struct gpio_desc *spi_en; bool spi_en_polarity_high; }; /* * Note that these low level api's are active high */ -static inline void deassert_reset(unsigned int gpio) +static inline void deassert_reset(struct gpio_desc *gpio) { - gpio_set_value(gpio, 1); + gpiod_set_value(gpio, 1); } -static inline void assert_reset(unsigned int gpio) +static inline void assert_reset(struct gpio_desc *gpio) { - gpio_set_value(gpio, 0); + gpiod_set_value(gpio, 0); } /* @@ -76,11 +74,11 @@ static int coldboot_seq(struct platform_device *pdev) return 0; /* Hold APB in reset state */ - assert_reset(apb->resetn_gpio); + assert_reset(apb->resetn); if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING && - gpio_is_valid(apb->spi_en_gpio)) - devm_gpio_free(dev, apb->spi_en_gpio); + apb->spi_en) + devm_gpiod_put(dev, apb->spi_en); /* Enable power to APB */ if (!IS_ERR(apb->vcore)) { @@ -102,13 +100,13 @@ static int coldboot_seq(struct platform_device *pdev) apb_bootret_deassert(dev); /* On DB3 clock was not mandatory */ - if (gpio_is_valid(apb->clk_en_gpio)) - gpio_set_value(apb->clk_en_gpio, 1); + if (apb->clk_en) + gpiod_set_value(apb->clk_en, 1); usleep_range(100, 200); /* deassert reset to APB : Active-low signal */ - deassert_reset(apb->resetn_gpio); + deassert_reset(apb->resetn); apb->state = ARCHE_PLATFORM_STATE_ACTIVE; @@ -120,6 +118,7 @@ static int fw_flashing_seq(struct platform_device *pdev) struct device *dev = >dev; struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev); int ret; + unsigned long flags; if (apb->init_disabled || apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING) @@ -137,25 +136,20 @@ static int fw_flashing_seq(struct platform_device *pdev) return ret; } - if (gpio_is_valid(apb->spi_en_gpio)) { - unsigned long flags; - - if (apb->spi_en_polarity_high) - flags = GPIOF_OUT_INIT_HIGH; - else - flags = GPIOF_OUT_INIT_LOW; + if (apb->spi_en_polarity_high) + flags = GPIOD_OUT_HIGH; + else + flags = GPIOD_OUT_LOW; - ret = devm_gpio_request_one(dev, apb->spi_en_gpio, - flags, "apb_spi_en"); - if (ret) { - dev_err(dev, "Failed requesting SPI bus en gpio %d\n", - apb->spi_en_gpio); - return ret; - } + apb->spi_en = devm_gpiod_get(dev, "gb,apb_spi_en", flags); + if (IS_ERR(apb->spi_en)) { + ret = PTR_ERR(apb->spi_en); + dev_err(dev, "Failed requesting SPI bus en GPIO: %d\n", ret); + return ret; } /* for flashing device should be in reset state */ - assert_reset(apb->resetn_gpio); + assert_reset(apb->resetn); apb->state = ARCHE_PLATFORM_STATE_FW_FLASHING; return 0; @@ -178,8 +172,8 @@ static int standby_boot_seq(struct platform_device *pdev) return 0; if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING && -
RE: [PATCH V2 3/5] Drivers: hv: kvp: Fix the recent regression caused by incorrect clean-up
> From: gre...@linuxfoundation.org > Sent: Thursday, November 1, 2018 21:54 > To: Dexuan Cui > Cc: Michael Kelley ; KY Srinivasan > ; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > jasow...@redhat.com; Stephen Hemminger ; > vkuznets ; Sasha Levin > ; Haiyang Zhang ; > sta...@vger.kernel.org > Subject: Re: [PATCH V2 3/5] Drivers: hv: kvp: Fix the recent regression caused > by incorrect clean-up > > On Thu, Nov 01, 2018 at 07:22:28PM +, Dexuan Cui wrote: > > > From: gre...@linuxfoundation.org > > > Sent: Thursday, November 1, 2018 11:57 > > > To: Dexuan Cui > > > > > > On Wed, Oct 31, 2018 at 11:23:54PM +, Dexuan Cui wrote: > > > > > From: Michael Kelley > > > > > Sent: Wednesday, October 24, 2018 08:38 > > > > > From: k...@linuxonhyperv.com Sent: > > > Wednesday, > > > > > October 17, 2018 10:10 PM > > > > > > From: Dexuan Cui > > > > > > > > > > > > In kvp_send_key(), we do need call process_ib_ipinfo() if > > > > > > message->kvp_hdr.operation is KVP_OP_GET_IP_INFO, because it > turns > > > out > > > > > > the userland hv_kvp_daemon needs the info of operation, adapter_id > > > and > > > > > > addr_family. With the incorrect fc62c3b1977d, the host can't get the > > > > > > VM's IP via KVP. > > > > > > > > > > > > And, fc62c3b1977d added a "break;", but actually forgot to > > > > > > initialize > > > > > > the key_size/value in the case of KVP_OP_SET, so the default > > > > > > key_size > of > > > > > > 0 is passed to the kvp daemon, and the pool files > > > > > > /var/lib/hyperv/.kvp_pool_* can't be updated. > > > > > > > > > > > > This patch effectively rolls back the previous fc62c3b1977d, and > > > > > > correctly fixes the "this statement may fall through" warnings. > > > > > > > > > > > > This patch is tested on WS 2012 R2 and 2016. > > > > > > > > > > > > Fixes: fc62c3b1977d ("Drivers: hv: kvp: Fix two "this statement may > fall > > > > > through" warnings") > > > > > > Signed-off-by: Dexuan Cui > > > > > > Cc: K. Y. Srinivasan > > > > > > Cc: Haiyang Zhang > > > > > > Cc: Stephen Hemminger > > > > > > Cc: > > > > > > Signed-off-by: K. Y. Srinivasan > > > > > > --- > > > > > > drivers/hv/hv_kvp.c | 26 ++ > > > > > > 1 file changed, 22 insertions(+), 4 deletions(-) > > > > > > > > > > > Reviewed-by: Michael Kelley > > > > > > > > Hi Greg, > > > > Can you please take a look at this patch? > > > > > > Nope, I'm not the hv maintainer, they need to look at this and ack it, > > > not me :) > > > > > > greg k-h > > > > Hi Greg, > > KY has added his Signed-off-by in the mail. > > > > I'll ask the other HV maintainers to take a look as well. > > Ok, then I'll look at it after 4.20-rc1 is out, nothing I can do until > then anyway... > > thanks, > > greg k-h Hi Greg, Can you please take a look at the patch now? The patch has received Reviewed-by: Michael Kelley Signed-off-by: Haiyang Zhang Signed-off-by: K. Y. Srinivasan Thanks, -- Dexuan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3.16] staging: usbip stub_rx fix static checker warning on unnecessary checks
On Mon, 2018-02-26 at 14:12 -0700, Shuah Khan wrote: > Upstream commit 10c901209306 > ("usbip: stub_rx: fix static checker warning on unnecessary checks") > > Back-port fix for static checker warning on unnecessary checks > > smatch warnings: > drivers/staging/usbip/stub_rx.c:360 get_pipe() warn: impossible > condition '(pdu->u.cmd_submit.transfer_buffer_length > ((~0 >> 1))) => > (s32min-s32max > s32max)' > drivers/staging/usbip/stub_rx.c:501 stub_recv_cmd_submit() warn: always > true condition '(pdu->u.cmd_submit.transfer_buffer_length <= ((~0 >> > 1))) => (s32min-s32max <= s32max)' I've finally queued this up, thanks. Ben. > Reported-by: Dan Carpenter > Signed-off-by: Shuah Khan > --- > drivers/staging/usbip/stub_rx.c | 11 +-- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c > index 35f59747122a..d8544ab9577b 100644 > --- a/drivers/staging/usbip/stub_rx.c > +++ b/drivers/staging/usbip/stub_rx.c > @@ -356,14 +356,6 @@ static int get_pipe(struct stub_device *sdev, struct > usbip_header *pdu) > > epd = >desc; > > - /* validate transfer_buffer_length */ > - if (pdu->u.cmd_submit.transfer_buffer_length > INT_MAX) { > - dev_err(>udev->dev, > - "CMD_SUBMIT: -EMSGSIZE transfer_buffer_length %d\n", > - pdu->u.cmd_submit.transfer_buffer_length); > - return -1; > - } > - > if (usb_endpoint_xfer_control(epd)) { > if (dir == USBIP_DIR_OUT) > return usb_sndctrlpipe(udev, epnum); > @@ -497,8 +489,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, > } > > /* allocate urb transfer buffer, if needed */ > - if (pdu->u.cmd_submit.transfer_buffer_length > 0 && > - pdu->u.cmd_submit.transfer_buffer_length <= INT_MAX) { > + if (pdu->u.cmd_submit.transfer_buffer_length > 0) { > priv->urb->transfer_buffer = > kzalloc(pdu->u.cmd_submit.transfer_buffer_length, > GFP_KERNEL); -- Ben Hutchings Reality is just a crutch for people who can't handle science fiction. signature.asc Description: This is a digitally signed message part ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: mt7621-pinctrl: fix uninitialized variable ngroups
From: Colin Ian King Currently the for_each_node_with_property loop us incrementing variable ngroups however it was not initialized and hence will contain garbage. Fix this by initializing ngroups to zero. Detected with static analysis with cppcheck: drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c:89]: (error) Uninitialized variable: ngroups Fixes: e12a1a6e087b ("staging: mt7621-pinctrl: refactor rt2880_pinctrl_dt_node_to_map function") Signed-off-by: Colin Ian King --- drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c index b8566ed898f1..aa98fbb17013 100644 --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c @@ -82,7 +82,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev, struct property *prop; const char *function_name, *group_name; int ret; - int ngroups; + int ngroups = 0; unsigned int reserved_maps = 0; for_each_node_with_property(np_config, "group") -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/6] staging:iio:ad2s90: Add SPDX license identifier
On Sat, Nov 10, 2018 at 11:23 AM Fabio Estevam wrote:> > Hi Matheus, > > On Fri, Nov 9, 2018 at 10:27 PM Matheus Tavares Bernardino > wrote: > > > Got it, thanks for the explanation! I'll correct this in v2. > > One more suggestion: in v2 you could also consider to remove the legal > text that says GPL v2, as you are adding the SPDX tag. Okay, I'll do it! Thanks again for the review and suggestions! Matheus ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging: rtl8188eu: remove unnecessary parentheses in recv_linux.c
Remove unnecessary parentheses reported by checkpatch. Signed-off-by: Michael Straube --- drivers/staging/rtl8188eu/os_dep/recv_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index 0d253a84904d..9c9339863a4a 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -69,8 +69,8 @@ int rtw_recv_indicatepkt(struct adapter *padapter, struct sk_buff *skb; struct mlme_priv *pmlmepriv = >mlmepriv; - precvpriv = &(padapter->recvpriv); - pfree_recv_queue = &(precvpriv->free_recv_queue); + precvpriv = >recvpriv; + pfree_recv_queue = >free_recv_queue; skb = precv_frame->pkt; if (!skb) { -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: rtl8188eu: add spaces around '*' in recv_linux.c
Add spaces around '*' to conform with kernel coding style. Reported by checkpatch. Signed-off-by: Michael Straube --- drivers/staging/rtl8188eu/os_dep/recv_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index 764d33c4e839..0d253a84904d 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -38,7 +38,7 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) } else { cur_time = jiffies; - if (cur_time - psecuritypriv->last_mic_err_time < 60*HZ) { + if (cur_time - psecuritypriv->last_mic_err_time < 60 * HZ) { psecuritypriv->btkip_countermeasure = true; psecuritypriv->last_mic_err_time = 0; psecuritypriv->btkip_countermeasure_time = cur_time; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: rtl8188eu: use __func__ in recv_linux.c
Use __func__ instead of hardcoded function name. Reported by checkpatch. Signed-off-by: Michael Straube --- drivers/staging/rtl8188eu/os_dep/recv_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index 6f74f49bf3ab..764d33c4e839 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -75,7 +75,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, skb = precv_frame->pkt; if (!skb) { RT_TRACE(_module_recv_osdep_c_, _drv_err_, -("rtw_recv_indicatepkt():skb == NULL something wrong\n")); +("%s():skb == NULL something wrong\n", __func__)); goto _recv_indicatepkt_drop; } @@ -126,7 +126,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, rtw_free_recvframe(precv_frame, pfree_recv_queue); RT_TRACE(_module_recv_osdep_c_, _drv_info_, -("\n rtw_recv_indicatepkt :after netif_rx\n")); +("\n %s :after netif_rx\n", __func__)); return _SUCCESS; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: vchi: Add license id and change int type
Hi Andre, > Stefan Wahren hat am 7. November 2018 um 09:30 > geschrieben: > > > > > > Signed-off-by: André Almeida > > > > --- > > > > Hello! This is my first patch to Linux Kernel. Let me know any feedback > > --- > > drivers/staging/vc04_services/interface/vchi/vchi_mh.h | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_mh.h > > b/drivers/staging/vc04_services/interface/vchi/vchi_mh.h > > index 198bd076b666..42fc0c693d43 100644 > > --- a/drivers/staging/vc04_services/interface/vchi/vchi_mh.h > > +++ b/drivers/staging/vc04_services/interface/vchi/vchi_mh.h > > @@ -1,5 +1,5 @@ > > -/** > > - * Copyright (c) 2010-2012 Broadcom. All rights reserved. > > +/* SPDX-License-Identifier: GPL-2.0 */ > > Please use the C++ style for the SPDX id. Apologies. Please ignore this suggestion. C style is correct for header files. Stefan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: vchiq_arm: fix compat VCHIQ_IOC_AWAIT_COMPLETION
> Ben Wolsieffer hat am 4. November 2018 um 00:32 > geschrieben: > > > The compatibility ioctl wrapper for VCHIQ_IOC_AWAIT_COMPLETION assumes that > the native ioctl always uses a message buffer and decrements msgbufcount. > Certain message types do not use a message buffer and in this case > msgbufcount is not decremented, and completion->header for the message is > NULL. Because the wrapper unconditionally decrements msgbufcount, the > calling process may assume that a message buffer has been used even when > it has not. > > This results in a memory leak in the userspace code that interfaces with > this driver. When msgbufcount is decremented, the userspace code assumes > that the buffer can be freed though the reference in completion->header, > which cannot happen when the reference is NULL. > > This patch causes the wrapper to only decrement msgbufcount when the > native ioctl decrements it. Note that we cannot simply copy the native > ioctl's value of msgbufcount, because the wrapper only retrieves messages > from the native ioctl one at a time, while userspace may request multiple > messages. > > See https://github.com/raspberrypi/linux/pull/2703 for more discussion of > this patch. > > Fixes: 5569a12 ("staging: vchiq_arm: Add compatibility wrappers for ioctls") > > Signed-off-by: Ben Wolsieffer Acked-by: Stefan Wahren ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/6] staging:iio:ad2s90: Add SPDX license identifier
Hi Matheus, On Fri, Nov 9, 2018 at 10:27 PM Matheus Tavares Bernardino wrote: > Got it, thanks for the explanation! I'll correct this in v2. One more suggestion: in v2 you could also consider to remove the legal text that says GPL v2, as you are adding the SPDX tag. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel