From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thunderbolt: Fix to check return value of ida_simple_get
Date: Wed, 20 Mar 2019 12:56:31 +0200 [thread overview]
Message-ID: <20190320105631.GT3622@lahna.fi.intel.com> (raw)
In-Reply-To: <20190319172259.8874-1-pakki001@umn.edu>
On Tue, Mar 19, 2019 at 12:22:59PM -0500, Aditya Pakki wrote:
> ida_simple_get on failure can return an error. The patch ensures that
> the dev_set_name is set on non failure cases.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/thunderbolt/xdomain.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
> index e27dd8beb94b..b1768f595259 100644
> --- a/drivers/thunderbolt/xdomain.c
> +++ b/drivers/thunderbolt/xdomain.c
> @@ -772,7 +772,9 @@ static void enumerate_services(struct tb_xdomain *xd)
> svc->dev.bus = &tb_bus_type;
> svc->dev.type = &tb_service_type;
> svc->dev.parent = &xd->dev;
> - dev_set_name(&svc->dev, "%s.%d", dev_name(&xd->dev), svc->id);
> + if (svc->id >= 0)
> + dev_set_name(&svc->dev, "%s.%d", dev_name(&xd->dev),
> + svc->id);
I think the correct way to handle this case is to cleanup svc right
after the allocation fails and then break out without enumerating more
services.
next prev parent reply other threads:[~2019-03-20 10:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 17:22 [PATCH] thunderbolt: Fix to check return value of ida_simple_get Aditya Pakki
2019-03-20 10:56 ` Mika Westerberg [this message]
2019-03-20 12:54 ` Mukesh Ojha
-- strict thread matches above, loose matches on Subject: below --
2019-03-19 17:21 Aditya Pakki
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=20190320105631.GT3622@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=pakki001@umn.edu \
/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