linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: fsl: dpio: fix cpu range check
@ 2019-01-14  5:12 Bharat Bhushan
  2019-01-14 19:16 ` Li Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Bharat Bhushan @ 2019-01-14  5:12 UTC (permalink / raw)
  To: Roy Pledge, Leo Li, linux-kernel, linuxppc-dev, linux-arm-kernel
  Cc: Bharat Bhushan, bharatb.yadav

cpu_possible(cpu) will always return true when cpu parameter
is from cpumask_next().
Check for nr_cpu_ids rather than !cpu_possible(cpu).

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
---
 drivers/soc/fsl/dpio/dpio-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/fsl/dpio/dpio-driver.c b/drivers/soc/fsl/dpio/dpio-driver.c
index e58fcc9096e8..eb369dd9e0a7 100644
--- a/drivers/soc/fsl/dpio/dpio-driver.c
+++ b/drivers/soc/fsl/dpio/dpio-driver.c
@@ -133,7 +133,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
 	else
 		next_cpu = cpumask_next(next_cpu, cpu_online_mask);
 
-	if (!cpu_possible(next_cpu)) {
+	if (next_cpu >= nr_cpu_ids) {
 		dev_err(dev, "probe failed. Number of DPIOs exceeds NR_CPUS.\n");
 		err = -ERANGE;
 		goto err_allocate_irqs;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] soc: fsl: dpio: fix cpu range check
  2019-01-14  5:12 [PATCH] soc: fsl: dpio: fix cpu range check Bharat Bhushan
@ 2019-01-14 19:16 ` Li Yang
  2019-01-15  3:20   ` Bharat Bhushan
  0 siblings, 1 reply; 3+ messages in thread
From: Li Yang @ 2019-01-14 19:16 UTC (permalink / raw)
  To: Bharat Bhushan
  Cc: Roy Pledge, linuxppc-dev, linux-kernel, linux-arm-kernel, bharatb.yadav

On Sun, Jan 13, 2019 at 11:13 PM Bharat Bhushan <bharat.bhushan@nxp.com> wrote:
>
> cpu_possible(cpu) will always return true when cpu parameter
> is from cpumask_next().
> Check for nr_cpu_ids rather than !cpu_possible(cpu).

There is another patch pending merge seems to cover this issue too.
Please let me know if it doesn't.

https://lore.kernel.org/patchwork/patch/1020905/

Leo
>
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
> ---
>  drivers/soc/fsl/dpio/dpio-driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/fsl/dpio/dpio-driver.c b/drivers/soc/fsl/dpio/dpio-driver.c
> index e58fcc9096e8..eb369dd9e0a7 100644
> --- a/drivers/soc/fsl/dpio/dpio-driver.c
> +++ b/drivers/soc/fsl/dpio/dpio-driver.c
> @@ -133,7 +133,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
>         else
>                 next_cpu = cpumask_next(next_cpu, cpu_online_mask);
>
> -       if (!cpu_possible(next_cpu)) {
> +       if (next_cpu >= nr_cpu_ids) {
>                 dev_err(dev, "probe failed. Number of DPIOs exceeds NR_CPUS.\n");
>                 err = -ERANGE;
>                 goto err_allocate_irqs;
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] soc: fsl: dpio: fix cpu range check
  2019-01-14 19:16 ` Li Yang
@ 2019-01-15  3:20   ` Bharat Bhushan
  0 siblings, 0 replies; 3+ messages in thread
From: Bharat Bhushan @ 2019-01-15  3:20 UTC (permalink / raw)
  To: Leo Li
  Cc: Roy Pledge, linuxppc-dev, linux-kernel, linux-arm-kernel, bharatb.yadav



> -----Original Message-----
> From: Li Yang <leoyang.li@nxp.com>
> Sent: Tuesday, January 15, 2019 12:47 AM
> To: Bharat Bhushan <bharat.bhushan@nxp.com>
> Cc: Roy Pledge <roy.pledge@nxp.com>; linux-kernel@vger.kernel.org;
> linuxppc-dev@lists.ozlabs.org; linux-arm-kernel@lists.infradead.org;
> bharatb.yadav@gmail.com
> Subject: Re: [PATCH] soc: fsl: dpio: fix cpu range check
> 
> On Sun, Jan 13, 2019 at 11:13 PM Bharat Bhushan
> <bharat.bhushan@nxp.com> wrote:
> >
> > cpu_possible(cpu) will always return true when cpu parameter is from
> > cpumask_next().
> > Check for nr_cpu_ids rather than !cpu_possible(cpu).
> 
> There is another patch pending merge seems to cover this issue too.
> Please let me know if it doesn't.
> 
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flor
> e.kernel.org%2Fpatchwork%2Fpatch%2F1020905%2F&amp;data=02%7C01%
> 7Cbharat.bhushan%40nxp.com%7C47af6861c3f84094434c08d67a54e1c4%7C6
> 86ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636830902314446677&amp
> ;sdata=wLPuMGosXOT48Gm9K%2FBjm1IRbGQEWR4D%2FSqRt0I0XyE%3D&a
> mp;reserved=0

Description and intention of the patch was to fix some other issue but this also fixes the cpu range check issue in my patch.
My patch can be ignored.

Thanks
-Bharat

> 
> Leo
> >
> > Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
> > ---
> >  drivers/soc/fsl/dpio/dpio-driver.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/soc/fsl/dpio/dpio-driver.c
> > b/drivers/soc/fsl/dpio/dpio-driver.c
> > index e58fcc9096e8..eb369dd9e0a7 100644
> > --- a/drivers/soc/fsl/dpio/dpio-driver.c
> > +++ b/drivers/soc/fsl/dpio/dpio-driver.c
> > @@ -133,7 +133,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device
> *dpio_dev)
> >         else
> >                 next_cpu = cpumask_next(next_cpu, cpu_online_mask);
> >
> > -       if (!cpu_possible(next_cpu)) {
> > +       if (next_cpu >= nr_cpu_ids) {
> >                 dev_err(dev, "probe failed. Number of DPIOs exceeds
> NR_CPUS.\n");
> >                 err = -ERANGE;
> >                 goto err_allocate_irqs;
> > --
> > 2.20.1
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-15  3:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-14  5:12 [PATCH] soc: fsl: dpio: fix cpu range check Bharat Bhushan
2019-01-14 19:16 ` Li Yang
2019-01-15  3:20   ` Bharat Bhushan

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).