[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=W4yYZYBT5=PY2VUsdz-zNAm=jnnw_SZzwjWzm_FuViLQ@mail.gmail.com>
Date: Tue, 12 Mar 2013 09:14:34 -0700
From: Doug Anderson <dianders@...omium.org>
To: Naveen Krishna Chatradhi <ch.naveen@...sung.com>
Cc: linux-iio <linux-iio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-samsung-soc@...r.kernel.org, gregkh@...uxfoundation.org,
Naveen Krishna <naveenkrishna.ch@...il.com>,
Lars-Peter Clausen <lars@...afoo.de>
Subject: Re: [PATCH v2] iio: adc: exynos5_adc: fix compilation warnings
Naveen,
On Wed, Mar 6, 2013 at 7:09 PM, Naveen Krishna Chatradhi
<ch.naveen@...sung.com> wrote:
> - unsigned int version;
> + unsigned int version;
Given that you've changed exynos_adc_get_version() to return an int,
shouldn't this be an int too (not unsigned)?
> -static inline unsigned int exynos_adc_get_version(struct platform_device *pdev)
> +static inline int exynos_adc_get_version(struct platform_device *pdev)
> {
> const struct of_device_id *match;
>
> match = of_match_node(exynos_adc_match, pdev->dev.of_node);
> - return (unsigned int)match->data;
> + return (int)match->data;
Given that you're now checking for an error code below it seems like
you ought to generate one here. ;)
...AKA: return an error if match is NULL--don't dereference NULL.
> static int exynos_read_raw(struct iio_dev *indio_dev,
> @@ -117,7 +117,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
> long mask)
> {
> struct exynos_adc *info = iio_priv(indio_dev);
> - unsigned long timeout;
> + int timeout;
Why change this to an "int" when
wait_for_completion_interruptible_timeout() returns a long? I agree
with the removal of the "unsigned", though.
> + version = exynos_adc_get_version(pdev);
> + if (version < 0) {
> + dev_err(&pdev->dev, "no matching of_node, err = %d\n", version);
> + ret = version;
> + goto err_iio;
> + }
> +
> + info->version = version;
Optional (and perhaps a matter of preference): I'd eliminate the
"version" variable here and just re-use "ret" for storing the result
of exynos_adc_get_version().
-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists