mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Peter Senna Tschudin <peter.senna@collabora.com>,
	thomas@winischhofer.net, gregkh@linuxfoundation.org,
	trivial@kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Subject: Re: [PATCH 4/5] usb-misc: sisusbvga: Remove kmalloc logs and fix error path
Date: Wed, 6 Jan 2016 21:28:41 +0300	[thread overview]
Message-ID: <568D5CD9.70704@cogentembedded.com> (raw)
In-Reply-To: <1452012850-6990-5-git-send-email-peter.senna@collabora.com>

Hello.

On 1/5/2016 7:54 PM, Peter Senna Tschudin wrote:

> From: Peter Senna Tschudin <peter.senna@gmail.com>
>
> This patch remove four calls to dev_err() from sisusb_probe() as
> reporting memory allocation failures is redundant:
>
>   - Remove a call to dev_err() that was reporting unsuccesful call to
>     kzalloc().
>
>   - Remove two calls to dev_err() that were reporting unsuccesful calls
>     to kmalloc().
>
>   - Remove a call to dev_err() that was reporting unsuccesful call to
>     kmalloc(), and replace it by code that clean up previously allocated
>     resources and abort the probe with -ENOMEM. Before this modification
>     sisusb->SiS_Pr could be dereferenced even it was null.

    I think the bug fix should be in its own patch. Don't intermix fixes with 
cleanups please.

> Signed-off-by: Peter Senna Tschudin <peter.senna@collabora.com>
> ---
> Tested by compilation only.
>
>   drivers/usb/misc/sisusbvga/sisusb.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
> index 6cce4fb..875e365 100644
> --- a/drivers/usb/misc/sisusbvga/sisusb.c
> +++ b/drivers/usb/misc/sisusbvga/sisusb.c
[...]
>   	/* Allocate our SiS_Pr */
>   	sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL);
>   	if (!sisusb->SiS_Pr) {
> -		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate SiS_Pr\n");
> +		retval = -ENOMEM;
> +		goto error_4;
>   	}
>   #endif
>

MBR, Sergei


  reply	other threads:[~2016-01-06 18:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05 16:54 [PATCH 0/5] usb-misc: cleanup sisusbvga Peter Senna Tschudin
2016-01-05 16:54 ` [PATCH 1/5] usb-misc: sisusbvga: Fix coding style: white space Peter Senna Tschudin
2016-01-05 16:54 ` [PATCH 2/5] usb-misc: sisusbvga: Fix trivial coding style Peter Senna Tschudin
2016-01-05 16:54 ` [PATCH 3/5] usb-misc: sisusbvga: Remove assignments from if tests Peter Senna Tschudin
2016-01-05 16:54 ` [PATCH 4/5] usb-misc: sisusbvga: Remove kmalloc logs and fix error path Peter Senna Tschudin
2016-01-06 18:28   ` Sergei Shtylyov [this message]
2016-01-07 15:19     ` Peter Senna Tschudin
2016-01-05 16:54 ` [PATCH 5/5] usb-misc: sisusbvga: Remove null test before kfree() Peter Senna Tschudin
2016-01-05 18:53 ` [PATCH 0/5] usb-misc: cleanup sisusbvga Joe Perches
2016-01-06 15:30   ` Peter Senna Tschudin
2016-01-06 16:04     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=568D5CD9.70704@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.senna@collabora.com \
    --cc=peter.senna@gmail.com \
    --cc=thomas@winischhofer.net \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome