All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: "Markus Pargmann" <mpa@pengutronix.de>,
	"Shawn Guo" <shawn.guo@linaro.org>,
	"Samuel Ortiz" <sameo@linux.intel.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Peter Meerwald" <pmeerw@pmeerw.net>,
	"Hartmut Knaack" <knaack.h@gmx.de>,
	"Denis Carikli" <denis@eukrea.com>,
	"Eric Bénard" <eric@eukrea.com>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	linux-input@vger.kernel.org, linux-iio@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
	"Kumar Gala" <galak@codeaurora.org>
Subject: Re: [PATCH v5 1/6] mfd: fsl imx25 Touchscreen ADC driver
Date: Wed, 18 Feb 2015 12:08:44 +0000	[thread overview]
Message-ID: <20150218120844.GC22296@x1> (raw)
In-Reply-To: <CAOMZO5BjVrcb3t1=kQQYf=-PztzDpGk8S5ApsTThGekT1yTTnA@mail.gmail.com>

On Wed, 18 Feb 2015, Fabio Estevam wrote:

> On Wed, Feb 18, 2015 at 6:01 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Tue, 17 Feb 2015, Fabio Estevam wrote:
> >
> >> On Mon, Feb 16, 2015 at 11:38 AM, Lee Jones <lee.jones@linaro.org> wrote:
> >>
> >> >> +static int mx25_tsadc_setup_irq(struct platform_device *pdev,
> >> >> +                             struct mx25_tsadc *tsadc)
> >> >> +{
> >> >> +     struct device *dev = &pdev->dev;
> >> >> +     struct device_node *np = dev->of_node;
> >> >> +     int irq;
> >> >> +
> >> >> +     irq = platform_get_irq(pdev, 0);
> >> >> +     if (irq < 0) {
> >> >
> >> > What if 0 is returned?
> >>
> >> Then  imx25.dtsi would be passing irq=0 for the ADC, which would be
> >> totally wrong.
> >
> > Exactly, so it should be <=.
> 
> imx25.dtsi passes interrupts = <46>; for the touch screen controller,
> so the irq number will never be zero.

It doesn't matter what happens to be passed at the moment.  The
correct thing to do is enforce correct/full error checking.  Yes <0 is
an error, but so is =0, so encompass it in the checks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: "Markus Pargmann" <mpa@pengutronix.de>,
	"Shawn Guo" <shawn.guo@linaro.org>,
	"Samuel Ortiz" <sameo@linux.intel.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Peter Meerwald" <pmeerw@pmeerw.net>,
	"Hartmut Knaack" <knaack.h@gmx.de>,
	"Denis Carikli" <denis@eukrea.com>,
	"Eric Bénard" <eric@eukrea.com>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	linux-input@vger.kernel.org, linux-iio@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
	"Kumar Gala" <galak@codeaurora.org>
Subject: Re: [PATCH v5 1/6] mfd: fsl imx25 Touchscreen ADC driver
Date: Wed, 18 Feb 2015 12:08:44 +0000	[thread overview]
Message-ID: <20150218120844.GC22296@x1> (raw)
In-Reply-To: <CAOMZO5BjVrcb3t1=kQQYf=-PztzDpGk8S5ApsTThGekT1yTTnA@mail.gmail.com>

On Wed, 18 Feb 2015, Fabio Estevam wrote:

> On Wed, Feb 18, 2015 at 6:01 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Tue, 17 Feb 2015, Fabio Estevam wrote:
> >
> >> On Mon, Feb 16, 2015 at 11:38 AM, Lee Jones <lee.jones@linaro.org> wrote:
> >>
> >> >> +static int mx25_tsadc_setup_irq(struct platform_device *pdev,
> >> >> +                             struct mx25_tsadc *tsadc)
> >> >> +{
> >> >> +     struct device *dev = &pdev->dev;
> >> >> +     struct device_node *np = dev->of_node;
> >> >> +     int irq;
> >> >> +
> >> >> +     irq = platform_get_irq(pdev, 0);
> >> >> +     if (irq < 0) {
> >> >
> >> > What if 0 is returned?
> >>
> >> Then  imx25.dtsi would be passing irq=0 for the ADC, which would be
> >> totally wrong.
> >
> > Exactly, so it should be <=.
> 
> imx25.dtsi passes interrupts = <46>; for the touch screen controller,
> so the irq number will never be zero.

It doesn't matter what happens to be passed at the moment.  The
correct thing to do is enforce correct/full error checking.  Yes <0 is
an error, but so is =0, so encompass it in the checks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

WARNING: multiple messages have this Message-ID (diff)
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 1/6] mfd: fsl imx25 Touchscreen ADC driver
Date: Wed, 18 Feb 2015 12:08:44 +0000	[thread overview]
Message-ID: <20150218120844.GC22296@x1> (raw)
In-Reply-To: <CAOMZO5BjVrcb3t1=kQQYf=-PztzDpGk8S5ApsTThGekT1yTTnA@mail.gmail.com>

On Wed, 18 Feb 2015, Fabio Estevam wrote:

> On Wed, Feb 18, 2015 at 6:01 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Tue, 17 Feb 2015, Fabio Estevam wrote:
> >
> >> On Mon, Feb 16, 2015 at 11:38 AM, Lee Jones <lee.jones@linaro.org> wrote:
> >>
> >> >> +static int mx25_tsadc_setup_irq(struct platform_device *pdev,
> >> >> +                             struct mx25_tsadc *tsadc)
> >> >> +{
> >> >> +     struct device *dev = &pdev->dev;
> >> >> +     struct device_node *np = dev->of_node;
> >> >> +     int irq;
> >> >> +
> >> >> +     irq = platform_get_irq(pdev, 0);
> >> >> +     if (irq < 0) {
> >> >
> >> > What if 0 is returned?
> >>
> >> Then  imx25.dtsi would be passing irq=0 for the ADC, which would be
> >> totally wrong.
> >
> > Exactly, so it should be <=.
> 
> imx25.dtsi passes interrupts = <46>; for the touch screen controller,
> so the irq number will never be zero.

It doesn't matter what happens to be passed at the moment.  The
correct thing to do is enforce correct/full error checking.  Yes <0 is
an error, but so is =0, so encompass it in the checks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2015-02-18 12:08 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-24 14:01 [PATCH v5 0/6] imx25 adc and touchscreen driver Markus Pargmann
2015-01-24 14:01 ` Markus Pargmann
2015-01-24 14:01 ` [PATCH v5 1/6] mfd: fsl imx25 Touchscreen ADC driver Markus Pargmann
2015-01-24 14:01   ` Markus Pargmann
     [not found]   ` <1422108103-15052-2-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-02-16 13:38     ` Lee Jones
2015-02-16 13:38       ` Lee Jones
2015-02-16 13:38       ` Lee Jones
2015-02-17 18:54       ` Fabio Estevam
2015-02-17 18:54         ` Fabio Estevam
2015-02-17 18:54         ` Fabio Estevam
2015-02-18  8:01         ` Lee Jones
2015-02-18  8:01           ` Lee Jones
2015-02-18  8:01           ` Lee Jones
2015-02-18 11:57           ` Fabio Estevam
2015-02-18 11:57             ` Fabio Estevam
2015-02-18 11:57             ` Fabio Estevam
2015-02-18 12:08             ` Lee Jones [this message]
2015-02-18 12:08               ` Lee Jones
2015-02-18 12:08               ` Lee Jones
2015-02-26 15:32               ` Markus Pargmann
2015-02-26 15:32                 ` Markus Pargmann
2015-02-17 19:14     ` Uwe Kleine-König
2015-02-17 19:14       ` Uwe Kleine-König
2015-02-17 19:14       ` Uwe Kleine-König
2015-03-02 19:12       ` Markus Pargmann
2015-03-02 19:12         ` Markus Pargmann
2015-01-24 14:01 ` [PATCH v5 2/6] ARM: dt: Binding documentation for imx25 ADC/TSC Markus Pargmann
2015-01-24 14:01   ` Markus Pargmann
2015-01-24 14:01 ` [PATCH v5 3/6] iio: adc: fsl,imx25-gcq driver Markus Pargmann
2015-01-24 14:01   ` Markus Pargmann
2015-01-27 20:30   ` Jonathan Cameron
2015-01-27 20:30     ` Jonathan Cameron
     [not found]     ` <54C7F580.1030901-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-01-29 10:11       ` Markus Pargmann
2015-01-29 10:11         ` Markus Pargmann
2015-01-29 10:11         ` Markus Pargmann
     [not found]         ` <20150129101104.GE27422-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-02-08 11:56           ` Jonathan Cameron
2015-02-08 11:56             ` Jonathan Cameron
2015-02-08 11:56             ` Jonathan Cameron
     [not found]   ` <1422108103-15052-4-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-01-29 14:51     ` Fabio Estevam
2015-01-29 14:51       ` Fabio Estevam
2015-01-29 14:51       ` Fabio Estevam
2015-01-30  7:27       ` Markus Pargmann
2015-01-30  7:27         ` Markus Pargmann
2015-01-24 14:01 ` [PATCH v5 4/6] input: touchscreen: imx25 tcq driver Markus Pargmann
2015-01-24 14:01   ` Markus Pargmann
     [not found] ` <1422108103-15052-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-01-24 14:01   ` [PATCH v5 5/6] ARM: dts: imx25: Add TSC and ADC support Markus Pargmann
2015-01-24 14:01     ` Markus Pargmann
2015-01-24 14:01     ` Markus Pargmann
2015-01-24 14:01 ` [PATCH v5 6/6] ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller " Markus Pargmann
2015-01-24 14:01   ` Markus Pargmann

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=20150218120844.GC22296@x1 \
    --to=lee.jones@linaro.org \
    --cc=denis@eukrea.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=eric@eukrea.com \
    --cc=festevam@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jic23@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mpa@pengutronix.de \
    --cc=pawel.moll@arm.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=shawn.guo@linaro.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.