[PATCH] NFC: pn533: Avoid a double free in error handling code

2016-07-19 Thread Christophe JAILLET
'phy' has been allocated with 'devm_kzalloc', so we should not free it using an explicit 'kfree'. It would result in a double free if the allocation of 'in_buf' fails. Signed-off-by: Christophe JAILLET --- drivers/nfc/pn533/usb.c | 9 +++-- 1 fi

[PATCH] drm/nouveau/secboot/gm20b: Fix return value in case of error

2016-09-23 Thread Christophe JAILLET
If 'ioremap()' returns 0, 'gm20b_tegra_read_wpr()' will return 0 as well, which means success. Return -ENOMEM instead Signed-off-by: Christophe JAILLET --- Not sure that -ENOMEM is the best value. I've taken it because it is often used in such a case. --- drivers/gp

[PATCH] [media] VPU: mediatek: Fix return value in case of error

2016-09-23 Thread Christophe JAILLET
If 'dma_alloc_coherent()' returns NULL, 'vpu_alloc_ext_mem()' will return 0 which means success. Return -ENOMEM instead. Signed-off-by: Christophe JAILLET --- drivers/media/platform/mtk-vpu/mtk_vpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver

[PATCH] drm/tegra: sor: No need to free devm_ allocated memory

2016-09-24 Thread Christophe JAILLET
r_brick_register()'. Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/tegra/sor.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 74d0540b8d4c..a8f528925009 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/dr

[PATCH] clk: at91: Fix a return value in case of error

2016-09-24 Thread Christophe JAILLET
returned by clk_register(). Fix commit f5644f10dcfb ("clk: at91: Migrate to clk_hw based registration and OF APIs") Signed-off-by: Christophe JAILLET --- It is likely that a bigger change is needed. For example using clk_register instead of clk_hw_register would return the err

[PATCH v2] clk: at91: Fix a return value in case of error

2016-09-25 Thread Christophe JAILLET
If 'clk_hw_register()' fails, it is likely that we expect to return an error instead of a valid pointer (which would mean success). Fix commit f5644f10dcfb ("clk: at91: Migrate to clk_hw based registration and OF APIs") Signed-off-by: Christophe JAILLET --- v2: clk_hw_reg

[PATCH] spmi: pmic-arb: Return an error code if sanity check fails

2016-09-26 Thread Christophe JAILLET
If the test 'if (channel > 5)' is true, then we will return 'err' which is known to be 0 at this point. Return -EINVAL instead. Signed-off-by: Christophe JAILLET --- Un-tested --- drivers/spmi/spmi-pmic-arb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers

Re: [PATCH] sctp: Remove some redundant code

2016-09-15 Thread Christophe JAILLET
Le 15/09/2016 à 19:34, Marcelo a écrit : On Sun, Sep 04, 2016 at 11:38:13AM +0200, Christophe JAILLET wrote: In commit 311b21774f13 ("sctp: simplify sk_receive_queue locking"), a call to 'skb_queue_splice_tail_init()' has been made explicit. Previously it was hidden in

[PATCH] mwifiex: scan: Simplify code

2016-08-31 Thread Christophe JAILLET
This patch: - improves code layout - removes a useless memset(0) for some memory allocated with kzalloc - removes a useless if. We know that 'if (chan_band_tlv)' will succeed because it has been tested a few lines above Signed-off-by: Christophe JAILLET --- drivers/ne

[PATCH] [media] s5p_cec: Fix memory allocation failure check

2016-08-31 Thread Christophe JAILLET
It is likely that checking the result of the memory allocation just above is expected here. Signed-off-by: Christophe JAILLET --- drivers/staging/media/s5p-cec/s5p_cec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/s5p-cec/s5p_cec.c b/drivers

[PATCH] ASoC: omap-pcm: off-by-one in 'omap_pcm_limit_supported_formats'

2016-08-31 Thread Christophe JAILLET
When calling 'snd_pcm_format_physical_width', SNDRV_PCM_FORMAT_LAST is a valid value, so don't skip it. Signed-off-by: Christophe JAILLET --- Un-tested --- sound/soc/omap/omap-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/omap/omap-pcm.c b

[PATCH] ASoC: davinci-mcasp: off-by-one in 'davinci_mcasp_hw_rule_format'

2016-09-01 Thread Christophe JAILLET
When calling 'snd_pcm_format_width', SNDRV_PCM_FORMAT_LAST is a valid value, so don't skip it. Signed-off-by: Christophe JAILLET --- Un-tested --- sound/soc/davinci/davinci-mcasp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/davinci/davinci-mcasp

[PATCH 1/2] mwifiex: fix the length parameter of a memset

2016-08-08 Thread Christophe JAILLET
f its type. Signed-off-by: Christophe JAILLET --- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index e06647a..78819e8 10064

[PATCH 2/2] mwifiex: simplify length computation for some memset

2016-08-08 Thread Christophe JAILLET
This patch should be a no-op. It just simplifies code by using the name of a variable instead of its type when calling 'sizeof'. Signed-off-by: Christophe JAILLET --- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

Re: [PATCH] serial: vt8500_serial: Fix a parameter of find_first_zero_bit.

2016-08-23 Thread Christophe JAILLET
Le 23/08/2016 à 11:23, Arnd Bergmann a écrit : On Tuesday, August 23, 2016 6:20:28 AM CEST Christophe JAILLET wrote: Le 22/08/2016 à 10:42, Arnd Bergmann a écrit : [...] Sorry, but I'm not following the logic here. [...] You argue that the two have the same meaning, which I see, but why

[PATCH v2] serial: vt8500_serial: Fix a parameter of find_first_zero_bit.

2016-08-23 Thread Christophe JAILLET
this bitmap - modify code now that 'vt8500_ports_in_use' has become a pointer because of the use of DECLARE_BITMAP It has been spotted by the following coccinelle script: @@ expression ret, x; @@ * ret = \(find_first_bit \| find_first_zero_bit\) (x, sizeof(...)); Signed-off-by: Christophe

[PATCH 1/2] IB/hfi1: Fix a parameter of find_first_bit.

2016-08-25 Thread Christophe JAILLET
64 instead. It has been spotted by the following coccinelle script: @@ expression ret, x; @@ * ret = \(find_first_bit \| find_first_zero_bit\) (x, sizeof(...)); Signed-off-by: Christophe JAILLET --- Not sure that using 64 directly is the best option. Maybe '8 * sizeof(port_mask)' as

[PATCH 2/2] IB/hfi1: Clean up type used and casting

2016-08-25 Thread Christophe JAILLET
In all other places in this file where 'find_first_bit' is called, port_num is defined as a 'u8' and no casting is done. Do the same here in order to be more consistent. Signed-off-by: Christophe JAILLET --- drivers/infiniband/hw/hfi1/mad.c | 4 ++-- 1 file changed

[PATCH] IB/mlx5: Fix a parameter of find_first_bit

2016-08-25 Thread Christophe JAILLET
So use BITS_PER_LONG instead. It has been spotted by the following coccinelle script: @@ expression ret, x; @@ * ret = \(find_first_bit \| find_first_zero_bit\) (x, sizeof(...)); Signed-off-by: Christophe JAILLET --- __ffs could be used to reduce code verbosity --- drivers/infiniband/hw/mlx5/me

[PATCH] EDAC, thunderx: Fix an error handling path in 'thunderx_lmc_probe()'

2017-08-15 Thread Christophe JAILLET
'ret' is known to be 0 at this point. If 'ioremap()' fails, returns -ENOMEM instead of 0 which means success. Signed-off-by: Christophe JAILLET --- drivers/edac/thunderx_edac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/edac/thunderx_edac.c b/drivers/edac/t

[PATCH] EDAC, altera: Fix an error handling path in 'altr_edac_device_probe()'

2017-08-15 Thread Christophe JAILLET
'res' is known to be 0 at this point. If 'devm_ioremap()' fails, returns -ENOMEM instead of 0 which means success. Signed-off-by: Christophe JAILLET --- drivers/edac/altera_edac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/edac/altera_e

[PATCH] crypto: cavium/nitrox - Fix an error handling path in 'nitrox_probe()'

2017-08-15 Thread Christophe JAILLET
'err' is known to be 0 at this point. If 'kzalloc()' fails, returns -ENOMEM instead of 0 which means success. Signed-off-by: Christophe JAILLET --- drivers/crypto/cavium/nitrox/nitrox_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/

[PATCH] sata: ahci-da850: Fix some error handling paths in 'ahci_da850_probe()'

2017-08-15 Thread Christophe JAILLET
'rc' is known to be 0 at this point. If 'platform_get_resource()' or 'devm_ioremap()' fail, return -ENOMEM instead of 0 which means success. Signed-off-by: Christophe JAILLET --- drivers/ata/ahci_da850.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletion

[PATCH] mcb: Fix an error handling path in 'chameleon_parse_cells()'

2017-08-16 Thread Christophe JAILLET
’ may be used uninitialized in this function")) Signed-off-by: Christophe JAILLET --- drivers/mcb/mcb-parse.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mcb/mcb-parse.c b/drivers/mcb/mcb-parse.c index ee7fb6ec96bd..7369bda3442f 100644 --- a/drivers/mcb/m

[PATCH] cfg80211: Fix a memory leak in error handling path in 'brcmf_cfg80211_attach'

2017-06-19 Thread Christophe JAILLET
If 'wiphy_new()' fails, we leak 'ops'. Add a new label in the error handling path to free it in such a case. Fixes: 5c22fb85102a7 ("brcmfmac: add wowl gtk rekeying offload support") Signed-off-by: Christophe JAILLET --- drivers/net/wireless/broadcom/brcm80211/brcmf

[PATCH v2] brcmfmac: Fix a memory leak in error handling path in 'brcmf_cfg80211_attach'

2017-06-20 Thread Christophe JAILLET
If 'wiphy_new()' fails, we leak 'ops'. Add a new label in the error handling path to free it in such a case. Cc: sta...@vger.kernel.org Fixes: 5c22fb85102a7 ("brcmfmac: add wowl gtk rekeying offload support") Signed-off-by: Christophe JAILLET --- v2: Add CC tag

Re: [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()'

2017-10-15 Thread Christophe JAILLET
Le 12/10/2017 à 18:25, Bartlomiej Zolnierkiewicz a écrit : [ added dri-devel ML to cc: ] On Tuesday, September 12, 2017 07:39:30 AM Christophe JAILLET wrote: If 'dmam_alloc_attrs()' fails, we must go through the error handling code, as done elsewhere in this function. Otherwise,

[PATCH 7/8] video: fbdev: au1200fb: Propagate an error code

2017-10-16 Thread Christophe JAILLET
We should propagate the error code returned by 'fb_alloc_cmap()' instead of returning -EFAULT. Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/au1200fb.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/v

[PATCH 8/8] video: fbdev: au1200fb: Style clean up

2017-10-16 Thread Christophe JAILLET
Style clean-up. Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/au1200fb.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index 687ea2a8f810..87d5a62bf6ca 100644 --- a/drivers/video/fbdev

[PATCH 0/8] video: fbdev: au1200fb: Fix error handling path of 'au1200fb_drv_probe()'

2017-10-16 Thread Christophe JAILLET
nd won't install one. This serie already goes further that the fixes I usually provide, so please excuse me if I missed something or if it is somehow broken and/or incomplete. --- V1 previously posted is patch 3/8 of this serie Christophe JAILLET (8): video: fbdev: au1200fb: Fix a potential d

[PATCH 3/8] video: fbdev: au1200fb: Release some resources if a memory allocation fails

2017-10-16 Thread Christophe JAILLET
We should go through the error handling code instead of returning -ENOMEM directly. Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/au1200fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index

[PATCH 4/8] video: fbdev: au1200fb: Fix error handling path

2017-10-16 Thread Christophe JAILLET
RQ") So, remove it. Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/au1200fb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index cf54168d44dc..0d8ed0ef9183 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/v

[PATCH 5/8] video: fbdev: au1200fb: Fix error handling path

2017-10-16 Thread Christophe JAILLET
au1200fb_infos' array, we know that we have released all what we needed to release. So we can 'break'. Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/au1200fb.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/au1

[PATCH 6/8] video: fbdev: au1200fb: Remove some dead code

2017-10-16 Thread Christophe JAILLET
There is no need to shut gcc up. It should not complain. Axe 'fbdev', it is never used in this function. Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/au1200fb.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/

[PATCH 1/8] video: fbdev: au1200fb: Fix a potential double free

2017-10-16 Thread Christophe JAILLET
. This leads to a double free of 'fbi->pseudo_palette'. Fix it by letting the caller free all resources in case of failure in 'au1200fb_init_fbinfo()'. Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/au1200fb.c | 1 - 1 file changed, 1 deletion(-) diff -

[PATCH 2/8] video: fbdev: au1200fb: Return an error code if a memory allocation fails

2017-10-16 Thread Christophe JAILLET
'ret' is known to be 0 at this point. In case of memory allocation error in 'framebuffer_alloc()', return -ENOMEM instead. Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/au1200fb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vide

[PATCH] remoteproc: qcom: Fix error handling paths in order to avoid memory leaks

2017-11-14 Thread Christophe JAILLET
ode to undo a previous 'request_firmware()', as already done in the other error handling paths of the function. Signed-off-by: Christophe JAILLET --- We could certainly also propagate the error code returned by 'q6v5_xfer_mem_ownership()' instead of returning an unconditional -E

Re: [PATCH] mtd: lpddr: Fix a potential double mutex_lock

2017-11-02 Thread Christophe JAILLET
Le 31/10/2017 à 15:58, Boris Brezillon a écrit : Hi Christophe, On Sun, 22 Oct 2017 10:28:31 +0200 Christophe JAILLET wrote: If 'chip->state == FL_SYNCING', we will 'goto retry' with the mutex '&shared->lock' already taken. In such a case, the 'm

[PATCH 0/4] fsl/fman: Fix some error handling code in mac_probe

2017-11-06 Thread Christophe JAILLET
ror handling path in the function. The 2nd one removes some devm_iounmap/release/kfree functions which look useless to me. The 3rd one fixes a missing of_node_put. The 4th one is just cosmetic and removes a useless message. Christophe JAILLET (4): fsl/fman: Remove a useless call to 'dev_

[PATCH 2/4] fsl/fman: Remove some useless code

2017-11-06 Thread Christophe JAILLET
handling paths. This is useless (priv->fixed_link is NULL at this point), but at least it is consistent. Signed-off-by: Christophe JAILLET --- drivers/net/ethernet/freescale/fman/mac.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/fm

[PATCH 4/4] fsl/fman: Remove a useless 'dev_err()' call

2017-11-06 Thread Christophe JAILLET
Memory allocation functions already display some informaton in case of memory allocation failure. There is no need to add an extra 'dev_err' here. Signed-off-by: Christophe JAILLET --- drivers/net/ethernet/freescale/fman/mac.c | 1 - 1 file changed, 1 deletion(-) diff --git a/d

[PATCH 3/4] fsl/fman: Add a missing 'of_node_put()' call in an error handling path

2017-11-06 Thread Christophe JAILLET
If 'of_phy_find_device()' fails, we must undo the previous 'of_node_get()' call, as done the the following error handling code. Signed-off-by: Christophe JAILLET --- drivers/net/ethernet/freescale/fman/mac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/eth

[PATCH 1/4] fsl/fman: Remove a useless call to 'dev_set_drvdata()'

2017-11-06 Thread Christophe JAILLET
Commit c6e26ea8c893 ("dpaa_eth: change device used") has removed usage of 'dev_set_drvdata()' in the 'mac_probe() function. This call should also be axed. Signed-off-by: Christophe JAILLET --- drivers/net/ethernet/freescale/fman/mac.c | 1 - 1 file changed, 1 deletion

[PATCH] NFC: nfcwilink: Drop a useless static qualifier

2015-10-12 Thread Christophe JAILLET
There is no need to have the 'struct nfcwilink *drv' variable static in the probe function. It only wastes a few bytes of memory. Signed-off-by: Christophe JAILLET --- drivers/nfc/nfcwilink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nfc/nfcwilink.c

[PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially freed memory

2015-10-14 Thread Christophe JAILLET
Use 'of_property_read_u32()' instead of 'of_get_property()'+pointer dereference in order to avoid access to potentially freed memory. Use 'of_get_next_parent()' to simplify the while() loop and avoid the need of a temp variable. Signed-off-by: Christophe JAILLET --

[PATCH] powerpc/prom: Avoid reference to potentially freed memory

2015-10-15 Thread Christophe JAILLET
. Signed-off-by: Christophe JAILLET --- *** UNTESTED *** --- arch/powerpc/kernel/prom.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index bef76c5..dc4f6a4 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc

Re: [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially freed memory

2015-10-15 Thread Christophe JAILLET
Le 15/10/2015 08:36, Michael Ellerman a écrit : On Thu, 2015-10-15 at 07:56 +0200, Christophe JAILLET wrote: Use 'of_property_read_u32()' instead of 'of_get_property()'+pointer dereference in order to avoid access to potentially freed memory. Use 'of_get_next_parent

Re: [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially freed memory

2015-10-16 Thread Christophe JAILLET
Le 16/10/2015 11:49, Michael Ellerman a écrit : On Fri, 2015-10-16 at 08:20 +0200, Christophe JAILLET wrote: Le 15/10/2015 08:36, Michael Ellerman a écrit : On Thu, 2015-10-15 at 07:56 +0200, Christophe JAILLET wrote: Use 'of_property_read_u32()' instead of 'of_get_prop

Re: [PATCH] powerpc/prom: Avoid reference to potentially freed memory

2015-10-16 Thread Christophe JAILLET
Le 16/10/2015 12:02, Michael Ellerman a écrit : As the kbuild robot detected you have left an extra "}" here. I don't mind too much if you send patches that aren't compile tested, but you might save yourself some time by compiling them. Sorry about it, and thanks for your patience. IMHO, this

[PATCH v2] powerpc/prom: Avoid reference to potentially freed memory

2015-10-16 Thread Christophe JAILLET
. Signed-off-by: Christophe JAILLET --- v2: Fix missing '{' *** COMPILE-TESTED ONLY *** --- arch/powerpc/kernel/prom.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index bef76c5..dc4f6a4 100644 --- a/ar

[PATCH v3] powerpc/prom: Avoid reference to potentially freed memory

2015-10-20 Thread Christophe JAILLET
of_get_next_parent to simplify code. Signed-off-by: Christophe JAILLET --- v2: Fix missing '{' v3: Use of_get_next_parent to simply code *** COMPILE-TESTED ONLY *** --- arch/powerpc/kernel/prom.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/powe

[PATCH] TPM: Avoid reference to potentially freed memory

2015-10-22 Thread Christophe JAILLET
Reference to the 'np' node is dropped before dereferencing the 'sizep' and 'basep' pointers, which could by then point to junk if the node has been freed. Refactor code to call 'of_node_pup' later. Signed-off-by: Christophe JAILLET --- drivers/char

[PATCH] spi: orion: Fix a resource leak if the optional "axi" clk is deferred

2018-01-25 Thread Christophe JAILLET
improve the names used. Fixes: 92ae112e477a ("spi: orion: Fix clock resource by adding an optional bus clock") Signed-off-by: Christophe JAILLET --- drivers/spi/spi-orion.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-orion.c b/dr

[PATCH v2] drm/vc4: Fix resource leak in 'vc4_get_hang_state_ioctl()' in error handling path

2017-05-12 Thread Christophe JAILLET
irst 'kcalloc' fails. This is harmless. - add a new label, err_delete_handle, in order to delete already allocated handles in error handling path - remove the now useless 'err' label The way the code is now written will also delete the handles if the 'copy_to_user()&#x

[PATCH V2] serial: efm32: Fix parity management in 'efm32_uart_console_get_options()'

2017-05-12 Thread Christophe JAILLET
UARTn_FRAME_PARITY_ODD is 0x0300 UARTn_FRAME_PARITY_EVEN is 0x0200 So if the UART is configured for EVEN parity, it would be reported as ODD. Fix it by correctly testing if the 2 bits are set. Fixes: 3afbd89c9639 ("serial/efm32: add new driver") Signed-off-by: Christophe JAILLET -

[PATCH V2] SMB2: Fix share type handling

2017-05-12 Thread Christophe JAILLET
ShareType value for equality instead. Fixes: faaf946a7d5b ("CIFS: Add tree connect/disconnect capability for SMB2") Signed-off-by: Christophe JAILLET --- V2: use a 'switch' instead of some 'if' The v1 and related comments are quite old. They can be found at: http:

[PATCH 2/2] ARM: davinci: PM: Do not free useful resources in normal path in 'davinci_pm_init'

2017-05-13 Thread Christophe JAILLET
;ARM: davinci: PM: rework init, remove platform device") Signed-off-by: Christophe JAILLET --- This patch is just a *guess*. The end of the function looks more like a error handling code rather than a normal path. --- arch/arm/mach-davinci/pm.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH 1/2] ARM: davinci: PM: Free resources in error handling path in 'davinci_pm_init'

2017-05-13 Thread Christophe JAILLET
If 'sram_alloc' fails, we need to free already allocated resources. Fixes: aa9aa1ec2df6 ("ARM: davinci: PM: rework init, remove platform device") Signed-off-by: Christophe JAILLET --- arch/arm/mach-davinci/pm.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) d

Re: [PATCH 2/2] ARM: davinci: PM: Do not free useful resources in normal path in 'davinci_pm_init'

2017-05-13 Thread Christophe JAILLET
Le 13/05/2017 à 15:22, walter harms a écrit : Am 13.05.2017 13:40, schrieb Christophe JAILLET: This looks spurious to iounmap resources in the normal path of this init function. The 3 ioremap'ed fields of 'pm_config' can be accessed later on in other functions, so it is likely

[PATCH 0/4] usb: gadget: fotg210-udc: Fixes and cleanup

2018-01-12 Thread Christophe JAILLET
evm_ function to simplify code. I've left the request_irq/free_irq because I'm unsure of potential side effects if some other resources are freed while an IRQ can still be triggered. So I've preferred to leave it as-is. Christophe JAILLET (4): usb: gadget: fotg210-udc: Remove a us

[PATCH 3/4] usb: gadget: fotg210-udc: Simplify code

2018-01-12 Thread Christophe JAILLET
Use 'devm_kzalloc()' and 'devm_ioremap()' to simplify code. While at it, turn some '== NULL' into shorter '!' when testing memory allocation failure. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/udc/fotg210-udc.c | 25 --

[PATCH 4/4] usb: gadget: fotg210-udc: Fix a potential invalid pointer dereference

2018-01-12 Thread Christophe JAILLET
pportunity to further simplify code. (In fact, this change should be a no-op, because 'req' is the first field of 'struct fotg210_request'. So passing NULL would result in 'free(NULL)' in 'fotg210_ep_free_request()'. Anyway avoiding the goto is cleaner.)

[PATCH 2/4] usb: gadget: fotg210-udc: Fix a memory leak

2018-01-12 Thread Christophe JAILLET
The memory referenced by the 'fotg210->ep[]' array, is never freed. So there is a memory leak in the error handling path of the probe function and when the driver is unloaded. Use 'devm_kzalloc()' to fix these leaks. Signed-off-by: Christophe JAILLET --- drivers/usb/gadge

[PATCH 1/4] usb: gadget: fotg210-udc: Remove a useless

2018-01-12 Thread Christophe JAILLET
There is no need to use an intermediate array for these memory allocations, so, axe it. While at it, turn a '== NULL' into a shorter '!' when testing memory allocation failure. Signed-off-by: Christophe JAILLET --- drivers/usb/gadget/udc/fotg210-udc.c | 6 ++ 1 file c

[PATCH] EDAC, mv64x60: Remove some code duplication

2018-01-12 Thread Christophe JAILLET
Reorder the error handling code in order to release the resources in reverse order than allocation. Introduce a new 'release_group' label in the error handling path and use it to void some code duplication. Signed-off-by: Christophe JAILLET --- drivers/edac/mv64x60_edac.c | 7 -

[PATCH] mtd: onenand: samsung: remove incorrect __iomem annotation

2018-01-13 Thread Christophe JAILLET
'page_buf' and 'oob_buf' are allocated with 'devm_kzalloc()' and should not have __iommem decoration. Remove these decorations and some useless casting. Signed-off-by: Christophe JAILLET --- drivers/mtd/onenand/samsung.c | 12 ++-- 1 file changed, 6 inser

Re: [PATCH] EDAC, mv64x60: Remove some code duplication

2018-01-13 Thread Christophe JAILLET
Le 13/01/2018 à 15:22, Borislav Petkov a écrit : + Chris Packham who's been fixing some stuff in here too. On Sat, Jan 13, 2018 at 08:28:21AM +0100, Christophe JAILLET wrote: Reorder the error handling code in order to release the resources in reverse order than allocation. Introduce

[PATCH] scsi: 3ware: use pci_iounmap instead of iounmap

2018-01-19 Thread Christophe JAILLET
'base_addr' has been mapped using 'pci_iomap()'. It should be freed with the corresponding 'pci_iounmap()' instead of 'iomap()'. Signed-off-by: Christophe JAILLET --- drivers/scsi/3w-sas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH] mdio-sun4i: Fix a memory leak

2018-01-06 Thread Christophe JAILLET
If the probing of the regulator is deferred, the memory allocated by 'mdiobus_alloc_size()' will be leaking. It should be freed before the next call to 'sun4i_mdio_probe()' which will reallocate it. Fixes: 4bdcb1dd9feb ("net: Add MDIO bus driver for the Allwinner EMAC&qu

[PATCH 1/2] ASoC: Intel: sst: Fix the return value of 'sst_send_byte_stream_mrfld()'

2018-01-06 Thread Christophe JAILLET
In some error handling paths, an error code is assiegned to 'ret'. However, the function always return 0. Fix it and return the error code if such an error paths is taken. Fixes: 3d9ff34622ba ("ASoC: Intel: sst: add stream operations") Signed-off-by: Christophe JAILLET ---

[PATCH 2/2] ASoC: Intel: sst: Fix some style

2018-01-06 Thread Christophe JAILLET
This patch fixes 3 small issues: - missing 2nd '*' at the beginning of a doxygen comment - extra space after a '\n' in a dev_dbg message - extra tab before a 'return" statement Signed-off-by: Christophe JAILLET --- sound/soc/intel/atom/sst/sst_stream.c

[PATCH] NFSv4.1: Ensure 'nfs4_sp4_select_mode()' can report -EINVAL when needed

2018-01-07 Thread Christophe JAILLET
he SP4_MACH_CRED flags in nfs4_sp4_select_mode()") Signed-off-by: Christophe JAILLET --- Untested and not sure at all if correct... --- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 17a03f2c4330..ae00ac59f59b 100644 --

[PATCH] EDAC, mv64x60: Fix an error handling path

2018-01-07 Thread Christophe JAILLET
We should not call 'edac_mc_del_mc()' if a corresponding call to 'edac_mc_add_mc()' has not been performed yet. So here, we should go to err instead of err2 to branch at the right place of the error handling path. Signed-off-by: Christophe JAILLET --- drivers/edac/mv64x60_e

[PATCH] iio: adc: aspeed: Fix error handling path

2018-01-07 Thread Christophe JAILLET
The labels and branching order of the error path of 'aspeed_adc_probe()' are broken. Re-order the labels and goto statements. Signed-off-by: Christophe JAILLET --- Not sure where it comes from. Merge conflict incorrectly fixed? --- drivers/iio/adc/aspeed_adc.c | 7 --- 1 file

[PATCH] spi: sprd: Use 'spi_master_put()' instead of 'spi_controller_put()'

2018-01-26 Thread Christophe JAILLET
'spi_alloc_master()' calls should be balanced by a 'spi_master_put()' call. 'spi_controller_put()' is equivalent (see include/linux/spi/spi.h) but it is cleaner and more logical to use 'spi_master_put()'. Signed-off-by: Christophe JAILLET --- drivers/s

[PATCH] regulator: of: Add a missing 'of_node_put()' in an error handling path of 'of_regulator_match()'

2018-01-26 Thread Christophe JAILLET
If an unlikely failure in 'of_get_regulator_init_data()' occurs, we must release the reference on the current 'child' node before returning. Signed-off-by: Christophe JAILLET --- drivers/regulator/of_regulator.c | 1 + 1 file changed, 1 insertion(+) diff --git

Re: [PATCH] EDAC, mv64x60: Remove some code duplication

2018-01-15 Thread Christophe JAILLET
Le 15/01/2018 à 23:31, Michael Ellerman a écrit : Chris Packham writes: On 14/01/18 06:17, Christophe JAILLET wrote: Le 13/01/2018 à 15:22, Borislav Petkov a écrit : + Chris Packham who's been fixing some stuff in here too. On Sat, Jan 13, 2018 at 08:28:21AM +0100, Christophe JAILLET

[PATCH] drm: zte: Fix an error handling path in 'zx_crtc_bind()'

2018-03-11 Thread Christophe JAILLET
'ret' is known to be 0 at this point. It must be updated by the value returned by 'clk_prepare_enable()'. Fixes: 0a886f59528a ("drm: zte: add initial vou drm driver") Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/zte/zx_vou.c | 2 +- 1 file changed, 1 ins

[PATCH] net/mlx4_en: Fix a memory leak in case of error in 'mlx4_en_init_netdev()'

2018-03-11 Thread Christophe JAILLET
If 'kzalloc' fails, we must free some memory before returning. Fixes: 67f8b1dcb9ee ("net/mlx4_en: Refactor the XDP forwarding rings scheme") Signed-off-by: Christophe JAILLET --- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 delet

[PATCH] drm/sun4i: Fix an error handling path in 'sun4i_drv_bind()'

2018-03-11 Thread Christophe JAILLET
rrect number of crtcs") Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/sun4i/sun4i_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 4570da0227b4..d9a71f361b14 100644 --- a/d

Re: [PATCH] net/mlx4_en: Fix a memory leak in case of error in 'mlx4_en_init_netdev()'

2018-03-12 Thread Christophe Jaillet
Le 12/03/2018 à 09:42, Tariq Toukan a écrit : > > > On 12/03/2018 12:45 AM, Christophe JAILLET wrote: >> If 'kzalloc' fails, we must free some memory before returning. >> >> Fixes: 67f8b1dcb9ee ("net/mlx4_en: Refactor the XDP forwarding rings >&g

[PATCH 0/3] Fix some error handling paths in 'meson_drv_bind_master()'

2018-03-12 Thread Christophe JAILLET
Patch 1 and 3 are fixes. Patch 2 is just a kind of clean-up noticed while patching this driver. If patch 2 is considered as useless, patch 3 can be applied on top of patch 1, it does nor depend on the 2nd patch. Christophe JAILLET (3): drm/meson: Fix an un-handled error path in

[PATCH 2/3] drm/meson: Use drm_dev_put() instead of drm_dev_unref()

2018-03-12 Thread Christophe JAILLET
According to 'drivers/gpu/drm/drm_drv.c', 'drm_dev_unref()' is just a compatibility alias for 'drm_dev_put()'. So use the latter instead. Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/meson/meson_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletion

[PATCH 1/3] drm/meson: Fix an un-handled error path in 'meson_drv_bind_master()'

2018-03-12 Thread Christophe JAILLET
'drm_vblank_init()' can fail. So handle this (unlikely) error. Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller") Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/meson/meson_drv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-)

[PATCH 3/3] drm/meson: Fix some error handling paths in 'meson_drv_bind_master()'

2018-03-12 Thread Christophe JAILLET
If one of these functions fail, we whould free 'drm', as alreadry done in the other error handling paths, below and above. Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller") Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/me

Re: [PATCH] staging: wilc1000: replace kmalloc + memcpy with kmemdup

2018-03-26 Thread Christophe Jaillet
Le 26/03/2018 à 19:16, Colin King a écrit : From: Colin Ian King Replace several allocation and memcpys with kmemdup and add in some missing memory allocation failure checks. Also fix an incorrect -EFAULT return with -ENOMEM. Signed-off-by: Colin Ian King --- drivers/staging/wilc1000/host_

[PATCH v2 2/2] iio: sca3000: Handle errors returned by 'sca3000_configure_ring()' in 'sca3000_probe()'

2018-04-08 Thread Christophe JAILLET
'sca3000_configure_ring()' can fail, so test its return value and propagate it if needed. Signed-off-by: Christophe JAILLET --- Same as v1 --- drivers/iio/accel/sca3000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers

[PATCH v2 1/2] iio: sca3000: Fix an error handling path in 'sca3000_probe()'

2018-04-08 Thread Christophe JAILLET
Use 'devm_iio_kfifo_allocate()' instead of 'iio_kfifo_allocate()' in order to simplify code and avoid a memory leak in an error path in 'sca3000_probe()'. A call to 'sca3000_unconfigure_ring()' was missing. Signed-off-by: Christophe JAILLET --- v2: Use a

[PATCH 0/4] HID: alps: Fix some bugs and improve code around 't4_read_write_register()'

2018-03-19 Thread Christophe JAILLET
All is said in the subject and below. These patches are untested. Especially, patch 1 slightly changes the behavior of 't4_read_write_register()'. This looks logical to me, but please, review it carefully. Christophe JAILLET (4): HID: alps: Report an error if we receive inval

[PATCH 4/4] HID: alps: Fix some style in 't4_read_write_register()'

2018-03-19 Thread Christophe JAILLET
Better indent the code to improve readability. Signed-off-by: Christophe JAILLET --- drivers/hid/hid-alps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index 137b963779c6..60d3950692d9 100644 --- a/drivers/hid/hid

[PATCH 1/4] HID: alps: Report an error if we receive invalid data in 't4_read_write_register()'

2018-03-19 Thread Christophe JAILLET
If the data received is not what is expected, we should return an error. Otherwise, we return 0 or a positive value which will be interpreted as success, but '*read_val' has not been updated. Fixes: 73196ebe134d ("HID: alps: add support for Alps T4 Touchpad device") Signe

[PATCH 2/4] HID: alps: Save a memory allocation in 't4_read_write_register()' when writing data

2018-03-19 Thread Christophe JAILLET
if 'read_flag' is false, there is no need to allocate and free memory. We can simply avoid the memory allocation and pass NULL to kfree. Signed-off-by: Christophe JAILLET --- drivers/hid/hid-alps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hi

[PATCH 3/4] HID: alps: Check errors returned by 't4_read_write_register()'

2018-03-19 Thread Christophe JAILLET
If only the first 't4_read_write_register()' call fails, the error code will be overwritten and lost. Directly report the error instead. While at it, log some errors if 't4_read_write_register()' fails, as done in the rest of the driver. Signed-off-by: Christophe JAILLET

[PATCH] spi: bcm-qspi: fIX some error handling paths

2018-03-13 Thread Christophe JAILLET
For some reason, commit c0368e4db4a3 ("spi: bcm-qspi: Fix use after free in bcm_qspi_probe() in error path") has updated some gotos, but not all of them. This looks spurious, so fix it. Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver") Signed-off-by: Christop

[PATCH] regulator: gpio: Fix some error handling paths in 'gpio_regulator_probe()'

2018-03-13 Thread Christophe JAILLET
Re-order error handling code and gotos to avoid leaks in error handling paths. Fixes: 9f946099fe19 ("regulator: gpio: fix parsing of gpio list") Signed-off-by: Christophe JAILLET --- drivers/regulator/gpio-regulator.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletion

[PATCH] staging: vme: vme_user: Fix some error handling paths in 'vme_user_probe()'

2018-03-13 Thread Christophe JAILLET
2 gotos in error handling paths branch to the wrong label. Fix it. Signed-off-by: Christophe JAILLET --- drivers/staging/vme/devices/vme_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices

[PATCH] net: lantiq: Fix returned value in case of error in 'xrx200_probe()'

2018-11-13 Thread Christophe JAILLET
Return 'err' in the error handling path instead of 0. Return explicitly 0 in the normal path, instead of 'err', which is known to be 0 at this point. Fixes: fe1a56420cf2 ("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver") Signed-off-by: Christophe JAIL

[PATCH] rtc: max77686: Fix the returned value in case of error in 'max77686_rtc_read_time()'

2018-11-13 Thread Christophe JAILLET
77686: stop validating rtc_time in .read_time") Signed-off-by: Christophe JAILLET --- drivers/rtc/rtc-max77686.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index 8a60900d6b8b..4aff349ae301 100644 --- a/drive

[PATCH] rtc: max8997: Fix the returned value in case of error in 'max8997_rtc_read_alarm()'

2018-11-14 Thread Christophe JAILLET
Signed-off-by: Christophe JAILLET --- Not sure that the Fixes tag is the right one. It is related, but not 100% accurate IMHO. --- drivers/rtc/rtc-max8997.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-max8997.c b/drivers/rtc/rtc-max8997.c index 08

[PATCH v2] rtc: max8997: Fix the returned value in case of error in 'max8997_rtc_read_alarm()'

2018-11-14 Thread Christophe JAILLET
In case of error, we return 0. This is spurious and not consistent with the other functions of the driver. Propagate the error code instead. Signed-off-by: Christophe JAILLET --- v2: re-word changelog and remove Fixes tag. (not sure if any should be provided, and which one would be the best

  1   2   3   4   5   6   7   8   9   10   >