All of lore.kernel.org
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: "Uwe Kleine-König" <uwe@kleine-koenig.org>,
	"Russell King" <linux@armlinux.org.uk>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Ulf Hansson" <ulf.hansson@linaro.org>
Cc: "Rob Herring" <robh@kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/5] vfio: platform: simplify device removal
Date: Wed, 2 Dec 2020 16:15:32 +0100	[thread overview]
Message-ID: <63756c77-2374-8493-6340-98c278a70353@redhat.com> (raw)
In-Reply-To: <20201124133139.3072124-4-uwe@kleine-koenig.org>

Hi Uwe,

On 11/24/20 2:31 PM, Uwe Kleine-König wrote:
> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> vfio_platform_remove_common() cannot return non-NULL in
> vfio_amba_remove() as the latter is only called if vfio_amba_probe()
> returned success.
> 
> Diagnosed-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric
> ---
>  drivers/vfio/platform/vfio_amba.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/vfio/platform/vfio_amba.c b/drivers/vfio/platform/vfio_amba.c
> index 9636a2afaecd..7b3ebf1558e1 100644
> --- a/drivers/vfio/platform/vfio_amba.c
> +++ b/drivers/vfio/platform/vfio_amba.c
> @@ -73,16 +73,12 @@ static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id)
>  
>  static int vfio_amba_remove(struct amba_device *adev)
>  {
> -	struct vfio_platform_device *vdev;
> -
> -	vdev = vfio_platform_remove_common(&adev->dev);
> -	if (vdev) {
> -		kfree(vdev->name);
> -		kfree(vdev);
> -		return 0;
> -	}
> +	struct vfio_platform_device *vdev =
> +		vfio_platform_remove_common(&adev->dev);
>  
> -	return -EINVAL;
> +	kfree(vdev->name);
> +	kfree(vdev);
> +	return 0;
>  }
>  
>  static const struct amba_id pl330_ids[] = {
> 


WARNING: multiple messages have this Message-ID (diff)
From: Auger Eric <eric.auger@redhat.com>
To: "Uwe Kleine-König" <uwe@kleine-koenig.org>,
	"Russell King" <linux@armlinux.org.uk>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Ulf Hansson" <ulf.hansson@linaro.org>
Cc: "Rob Herring" <robh@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH v2 3/5] vfio: platform: simplify device removal
Date: Wed, 2 Dec 2020 16:15:32 +0100	[thread overview]
Message-ID: <63756c77-2374-8493-6340-98c278a70353@redhat.com> (raw)
In-Reply-To: <20201124133139.3072124-4-uwe@kleine-koenig.org>

Hi Uwe,

On 11/24/20 2:31 PM, Uwe Kleine-König wrote:
> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> vfio_platform_remove_common() cannot return non-NULL in
> vfio_amba_remove() as the latter is only called if vfio_amba_probe()
> returned success.
> 
> Diagnosed-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric
> ---
>  drivers/vfio/platform/vfio_amba.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/vfio/platform/vfio_amba.c b/drivers/vfio/platform/vfio_amba.c
> index 9636a2afaecd..7b3ebf1558e1 100644
> --- a/drivers/vfio/platform/vfio_amba.c
> +++ b/drivers/vfio/platform/vfio_amba.c
> @@ -73,16 +73,12 @@ static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id)
>  
>  static int vfio_amba_remove(struct amba_device *adev)
>  {
> -	struct vfio_platform_device *vdev;
> -
> -	vdev = vfio_platform_remove_common(&adev->dev);
> -	if (vdev) {
> -		kfree(vdev->name);
> -		kfree(vdev);
> -		return 0;
> -	}
> +	struct vfio_platform_device *vdev =
> +		vfio_platform_remove_common(&adev->dev);
>  
> -	return -EINVAL;
> +	kfree(vdev->name);
> +	kfree(vdev);
> +	return 0;
>  }
>  
>  static const struct amba_id pl330_ids[] = {
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-12-02 15:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 13:31 [PATCH v2 0/5] amba: minor fix and various cleanups Uwe Kleine-König
2020-11-24 13:31 ` Uwe Kleine-König
2020-11-24 13:31 ` [PATCH v2 1/5] amba: Fix resource leak for drivers without .remove Uwe Kleine-König
2020-11-24 13:31   ` Uwe Kleine-König
2020-11-24 13:31 ` [PATCH v2 2/5] amba: reorder functions Uwe Kleine-König
2020-11-24 13:31   ` Uwe Kleine-König
2020-11-24 13:31 ` [PATCH v2 3/5] vfio: platform: simplify device removal Uwe Kleine-König
2020-11-24 13:31   ` Uwe Kleine-König
2020-12-02 15:15   ` Auger Eric [this message]
2020-12-02 15:15     ` Auger Eric
2020-11-24 13:31 ` [PATCH v2 4/5] amba: Make the remove callback return void Uwe Kleine-König
2020-11-24 13:31   ` Uwe Kleine-König
2020-12-03 11:53   ` Uwe Kleine-König
2020-12-03 11:53     ` Uwe Kleine-König
2020-12-03 13:01   ` Uwe Kleine-König
2020-12-03 13:01     ` Uwe Kleine-König
2020-12-03 14:11     ` Krzysztof Kozlowski
2020-12-03 14:11       ` Krzysztof Kozlowski
2020-12-03 14:16     ` Mark Brown
2020-12-03 14:16       ` Mark Brown
2020-12-03 19:36     ` Dmitry Torokhov
2020-12-03 19:36       ` Dmitry Torokhov
2020-12-14 20:40     ` Uwe Kleine-König
2020-12-14 20:40       ` Uwe Kleine-König
2020-12-17 10:00       ` Linus Walleij
2020-12-17 10:00         ` Linus Walleij
2020-12-03 13:44   ` Alexandre Belloni
2020-12-03 13:44     ` Alexandre Belloni
2020-11-24 13:31 ` [PATCH v2 5/5] amba: Make use of bus_type functions Uwe Kleine-König
2020-11-24 13:31   ` Uwe Kleine-König

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=63756c77-2374-8493-6340-98c278a70353@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=robh@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=ulf.hansson@linaro.org \
    --cc=uwe@kleine-koenig.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.