From: Pavel Machek <pavel@ucw.cz>
To: qiwuchen55@gmail.com
Cc: jacek.anaszewski@gmail.com, dmurphy@ti.com,
linux-leds@vger.kernel.org, chenqiwu <chenqiwu@xiaomi.com>
Subject: Re: [PATCH] leds: leds-nic78bx: handle error checking and error processing
Date: Mon, 27 Apr 2020 11:56:41 +0200 [thread overview]
Message-ID: <20200427095641.GB21572@duo.ucw.cz> (raw)
In-Reply-To: <1581695916-16708-1-git-send-email-qiwuchen55@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 979 bytes --]
Hi!
> From: chenqiwu <chenqiwu@xiaomi.com>
>
> Add error checking and error processing for led probe.
led->LED please.
Ok, I see that error handling there is clearly propblematic.
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
>
> +
> +err_led_classdev_register:
> + i -= 1;
> + while (i >= 0)
> + devm_led_classdev_unregister(dev, &nic78bx_leds[i--].cdev);
> + devm_release_region(dev, io_rc->start, resource_size(io_rc));
> +err_request_region:
> +err_res_size:
> + release_resource(io_rc);
> +err_get_res:
> + devm_kfree(dev, led_data);
> return ret;
But we should not need to do devm_ releasing in the error paths,
right? Core is expected to do that for us... AFAICT only
release_resource() is neccessary... unless it has some kind of devm_
variant.
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
prev parent reply other threads:[~2020-04-27 9:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 15:58 [PATCH] leds: leds-nic78bx: handle error checking and error processing qiwuchen55
2020-04-27 9:56 ` Pavel Machek [this message]
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=20200427095641.GB21572@duo.ucw.cz \
--to=pavel@ucw.cz \
--cc=chenqiwu@xiaomi.com \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-leds@vger.kernel.org \
--cc=qiwuchen55@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).