[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1607172057500.3177@hadrien>
Date: Sun, 17 Jul 2016 20:58:14 +0200 (CEST)
From: Julia Lawall <julia.lawall@...6.fr>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Wolfram Sang <wsa@...-dreams.de>, devel@...verdev.osuosl.org,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 3/9] staging: ks7010: Return directly after a failed
kmalloc()
On Sun, 17 Jul 2016, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Sun, 17 Jul 2016 15:55:02 +0200
>
> Return directly after a memory allocation failed at the beginning.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
> drivers/staging/ks7010/ks7010_sdio.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
> index 3622fba..9b954cb 100644
> --- a/drivers/staging/ks7010/ks7010_sdio.c
> +++ b/drivers/staging/ks7010/ks7010_sdio.c
> @@ -713,10 +713,8 @@ static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index)
> unsigned char *data_buf;
>
> data_buf = kmalloc(sizeof(u32), GFP_KERNEL);
> - if (!data_buf) {
> - rc = 1;
> - goto error_out;
> - }
> + if (!data_buf)
> + return 1;
One could rather wonder why the function has such strange error values...
julia
>
> memcpy(data_buf, &index, sizeof(index));
> retval = ks7010_sdio_write(priv, WRITE_INDEX, data_buf, sizeof(index));
> @@ -744,10 +742,9 @@ static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address,
> unsigned char *read_buf;
>
> read_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
> - if (!read_buf) {
> - rc = 1;
> - goto error_out;
> - }
> + if (!read_buf)
> + return 1;
> +
> retval = ks7010_sdio_read(priv, address, read_buf, size);
> if (retval) {
> rc = 2;
> @@ -777,10 +774,8 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
>
> /* buffer allocate */
> rom_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
> - if (!rom_buf) {
> - rc = 3;
> - goto error_out0;
> - }
> + if (!rom_buf)
> + return 3;
>
> sdio_claim_host(card->func);
>
> --
> 2.9.1
>
>
Powered by blists - more mailing lists