From: Mukesh Ojha <mojha@codeaurora.org>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Mika Westerberg <mika.westerberg@linux.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 18:24:00 +0530 [thread overview]
Message-ID: <6e3d1501-be71-ac95-2f47-ab928b3bc026@codeaurora.org> (raw)
In-Reply-To: <20190319172259.8874-1-pakki001@umn.edu>
On 3/19/2019 10:52 PM, 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>
> ---
We should add check against `ida_simple_get` instead of svc->id >= 0 and
clean up svc.
Also, It seems clean up is missing when device_register fails and it is
leaking svc.
Cheers,
Mukesh
> 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);
>
> if (device_register(&svc->dev)) {
> put_device(&svc->dev);
next prev parent reply other threads:[~2019-03-20 12:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 17:22 Aditya Pakki
2019-03-20 10:56 ` Mika Westerberg
2019-03-20 12:54 ` Mukesh Ojha [this message]
-- 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=6e3d1501-be71-ac95-2f47-ab928b3bc026@codeaurora.org \
--to=mojha@codeaurora.org \
--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=mika.westerberg@linux.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
Powered by JetHome