linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Kumaravel.Thiagarajan@microchip.com>
To: <christophe.jaillet@wanadoo.fr>, <arnd@arndb.de>,
	<gregkh@linuxfoundation.org>
Cc: <linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>,
	<linux-gpio@vger.kernel.org>
Subject: RE: [PATCH 3/3] misc: microchip: pci1xxxx: Fix the error handling paths of gp_aux_bus_probe()
Date: Mon, 19 Sep 2022 17:47:32 +0000	[thread overview]
Message-ID: <BN8PR11MB3668AE58BC463106D4BE57EFE94D9@BN8PR11MB3668.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1b41531de02ee029628d9b0ec2cf1ee7f180fe10.1663482259.git.christophe.jaillet@wanadoo.fr>

> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Sent: Sunday, September 18, 2022 11:58 AM
> To: Kumaravel Thiagarajan - I21417
> <Kumaravel.Thiagarajan@microchip.com>; Arnd Bergmann
> <arnd@arndb.de>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org;
> Christophe JAILLET <christophe.jaillet@wanadoo.fr>; linux-
> gpio@vger.kernel.org
> Subject: [PATCH 3/3] misc: microchip: pci1xxxx: Fix the error handling paths
> of gp_aux_bus_probe()
> 
> There are several issues related to the error handling paths of
> gp_aux_bus_probe():
>    - some resources may be released twice. Once explicitly in the error
>      handling path, and once via the release() function
>    - auxiliary_device_delete() should be called after the first successful
>      auxiliary_device_add()
Thanks for your patch. I had noticed this after one of the reviewers had only partially fixed them
up. I need some time to review and test your patch with the hardware before approving them.

> 
> To fix them, reorder the code:
>    - move the place where we get the irq for the 2nd wrapper.
>    - call kfree() and ida_free() after error checks, rather then in the
>      error handling path.
>    - have the error handling path look like the remove function
> 
> Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for
> the PIO function in the multi-function endpoint of pci1xxxx device.")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative and untested, review with care.
> 
> Other solutions are possible.
> For example, we could use devm_kzalloc() to simplify the error handling path
> and the release function.
I thought about this but had some doubts whether it will work with the auxiliary bus
architecture as the memory allocated will get tagged with the same device pointer.
I need to do some experiments before taking up this path.

Thank You.

Regards,
Kumar

  parent reply	other threads:[~2022-09-19 17:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18  6:27 [PATCH 0/3] misc: microchip: pci1xxxx: Fix the error handling path of gp_aux_bus_probe() Christophe JAILLET
2022-09-18  6:27 ` [PATCH 1/3] misc: microchip: pci1xxxx: Do not disable the pci device twice in gp_aux_bus_remove() Christophe JAILLET
2022-09-18  6:27 ` [PATCH 2/3] misc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe() Christophe JAILLET
2022-09-18  6:27 ` [PATCH 3/3] misc: microchip: pci1xxxx: Fix the error handling paths " Christophe JAILLET
2022-09-18  8:03   ` kernel test robot
2022-09-18  9:25     ` Christophe JAILLET
2022-09-19 17:47   ` Kumaravel.Thiagarajan [this message]
2022-09-21 22:59   ` kernel test robot

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=BN8PR11MB3668AE58BC463106D4BE57EFE94D9@BN8PR11MB3668.namprd11.prod.outlook.com \
    --to=kumaravel.thiagarajan@microchip.com \
    --cc=arnd@arndb.de \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).