All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "cgel.zte@gmail.com" <cgel.zte@gmail.com>,
	"mpe@ellerman.id.au" <mpe@ellerman.id.au>
Cc: "maz@kernel.org" <maz@kernel.org>, Zeal Robot <zealci@zte.com.cn>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Minghao Chi <chi.minghao@zte.com.cn>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>,
	"paulus@samba.org" <paulus@samba.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] powerpc/sysdev: Use of_device_get_match_data()
Date: Fri, 4 Mar 2022 13:10:19 +0000	[thread overview]
Message-ID: <6481b730-e338-294d-3602-bb899654ed2b@csgroup.eu> (raw)
In-Reply-To: <20220304011830.2061591-1-chi.minghao@zte.com.cn>



Le 04/03/2022 à 02:18, cgel.zte@gmail.com a écrit :
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> 
> Use of_device_get_match_data() to simplify the code.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> ---
>   arch/powerpc/sysdev/fsl_msi.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
> index b3475ae9f236..9d135bbb30b7 100644
> --- a/arch/powerpc/sysdev/fsl_msi.c
> +++ b/arch/powerpc/sysdev/fsl_msi.c
> @@ -387,7 +387,6 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
>   static const struct of_device_id fsl_of_msi_ids[];
>   static int fsl_of_msi_probe(struct platform_device *dev)
>   {
> -	const struct of_device_id *match;
>   	struct fsl_msi *msi;
>   	struct resource res, msiir;
>   	int err, i, j, irq_index, count;
> @@ -397,10 +396,7 @@ static int fsl_of_msi_probe(struct platform_device *dev)
>   	u32 offset;
>   	struct pci_controller *phb;
>   
> -	match = of_match_device(fsl_of_msi_ids, &dev->dev);
> -	if (!match)
> -		return -EINVAL;
> -	features = match->data;
> +	features = of_device_get_match_data(&dev->dev);

What happens when features is NULL ?

>   
>   	printk(KERN_DEBUG "Setting up Freescale MSI support\n");
>   

WARNING: multiple messages have this Message-ID (diff)
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "cgel.zte@gmail.com" <cgel.zte@gmail.com>,
	"mpe@ellerman.id.au" <mpe@ellerman.id.au>
Cc: Zeal Robot <zealci@zte.com.cn>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Minghao Chi <chi.minghao@zte.com.cn>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>,
	"paulus@samba.org" <paulus@samba.org>,
	"maz@kernel.org" <maz@kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] powerpc/sysdev: Use of_device_get_match_data()
Date: Fri, 4 Mar 2022 13:10:19 +0000	[thread overview]
Message-ID: <6481b730-e338-294d-3602-bb899654ed2b@csgroup.eu> (raw)
In-Reply-To: <20220304011830.2061591-1-chi.minghao@zte.com.cn>



Le 04/03/2022 à 02:18, cgel.zte@gmail.com a écrit :
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> 
> Use of_device_get_match_data() to simplify the code.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> ---
>   arch/powerpc/sysdev/fsl_msi.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
> index b3475ae9f236..9d135bbb30b7 100644
> --- a/arch/powerpc/sysdev/fsl_msi.c
> +++ b/arch/powerpc/sysdev/fsl_msi.c
> @@ -387,7 +387,6 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
>   static const struct of_device_id fsl_of_msi_ids[];
>   static int fsl_of_msi_probe(struct platform_device *dev)
>   {
> -	const struct of_device_id *match;
>   	struct fsl_msi *msi;
>   	struct resource res, msiir;
>   	int err, i, j, irq_index, count;
> @@ -397,10 +396,7 @@ static int fsl_of_msi_probe(struct platform_device *dev)
>   	u32 offset;
>   	struct pci_controller *phb;
>   
> -	match = of_match_device(fsl_of_msi_ids, &dev->dev);
> -	if (!match)
> -		return -EINVAL;
> -	features = match->data;
> +	features = of_device_get_match_data(&dev->dev);

What happens when features is NULL ?

>   
>   	printk(KERN_DEBUG "Setting up Freescale MSI support\n");
>   

  reply	other threads:[~2022-03-04 13:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04  1:18 [PATCH] powerpc/sysdev: Use of_device_get_match_data() cgel.zte
2022-03-04  1:18 ` cgel.zte
2022-03-04 13:10 ` Christophe Leroy [this message]
2022-03-04 13:10   ` Christophe Leroy
2022-03-04 14:26   ` Marc Zyngier
2022-03-04 14:26     ` Marc Zyngier
2022-03-04 14:29     ` Christophe Leroy
2022-03-04 14:29       ` Christophe Leroy
2022-03-07  0:44       ` Michael Ellerman

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=6481b730-e338-294d-3602-bb899654ed2b@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=cgel.zte@gmail.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maz@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    --cc=zealci@zte.com.cn \
    /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.