From: Michael Hennerich <michael.hennerich@analog.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: Re: [patch 1/2 -next] iio: frequency: adf4350: using an uninitialized variable
Date: Fri, 8 Jun 2012 09:24:01 +0200 [thread overview]
Message-ID: <4FD1A891.3090508@analog.com> (raw)
In-Reply-To: <20120608065432.GC26673@elgon.mountain>
On 06/08/2012 08:54 AM, Dan Carpenter wrote:
> GCC complains that we use an uninitialized variable if the user passes
> an invalid parameter to adf4350_read(). I decided that we should return
> -EINVAL instead in that case.
>
> However, when I looked up at adf4350_write() it returned -ENODEV for
> that condition. In the end, I decided the -EINVAL was the right thing
> and I change adf4350_write() to match.
Agreed.
>
> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
>
> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
> index fd4c850..4729bba 100644
> --- a/drivers/iio/frequency/adf4350.c
> +++ b/drivers/iio/frequency/adf4350.c
> @@ -272,7 +272,7 @@ static ssize_t adf4350_write(struct iio_dev *indio_dev,
> adf4350_sync_config(st);
> break;
> default:
> - ret = -ENODEV;
> + ret = -EINVAL;
> }
> mutex_unlock(&indio_dev->mlock);
>
> @@ -310,6 +310,8 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev,
> case ADF4350_PWRDOWN:
> val = !!(st->regs[ADF4350_REG2]& ADF4350_REG2_POWER_DOWN_EN);
> break;
> + default:
> + ret = -EINVAL;
> }
> mutex_unlock(&indio_dev->mlock);
>
>
--
Greetings,
Michael
--
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif
prev parent reply other threads:[~2012-06-08 7:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-08 6:54 [patch 1/2 -next] iio: frequency: adf4350: using an uninitialized variable Dan Carpenter
2012-06-08 7:24 ` Michael Hennerich [this message]
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=4FD1A891.3090508@analog.com \
--to=michael.hennerich@analog.com \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@cam.ac.uk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-iio@vger.kernel.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 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).