From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-iio@vger.kernel.org, Andreas Dannenberg <dannenberg@ti.com>,
Felipe Balbi <balbi@ti.com>, Hartmut Knaack <knaack.h@gmx.de>,
Javier Martinez Canillas <javier@osg.samsung.com>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] iio/light/opt3001: Use common error handling code in opt3001_get_lux()
Date: Thu, 26 Oct 2017 13:48:52 +0000 [thread overview]
Message-ID: <20171026134852.bprrrv3htfyryyy4@piout.net> (raw)
In-Reply-To: <c0b3ce73-db0d-c481-51be-2047b07c9f63@users.sourceforge.net>
On 26/10/2017 at 14:17:30 +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 26 Oct 2017 14:06:49 +0200
>
> * Add jump targets so that two error messages are stored only once
> at the end of this function implementation.
>
> * Adjust condition checks.
>
> * Replace string literals by references to two global constant variables
> in eight functions.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/iio/light/opt3001.c | 88 +++++++++++++++++++--------------------------
> 1 file changed, 36 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c
> index 54d88b60e303..23d7d4e6ae61 100644
> --- a/drivers/iio/light/opt3001.c
> +++ b/drivers/iio/light/opt3001.c
> @@ -77,6 +77,9 @@
> #define OPT3001_RESULT_READY_SHORT 150
> #define OPT3001_RESULT_READY_LONG 1000
>
> +static char const read_failure[] = "failed to read register %02x\n";
> +static char const write_failure[] = "failed to write register %02x\n";
> +
If you are going to do that, why don't you use only one string: "failed
to %s register %02x\n"?
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2017-10-26 13:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-26 12:17 [PATCH] iio/light/opt3001: Use common error handling code in opt3001_get_lux() SF Markus Elfring
2017-10-26 13:48 ` Alexandre Belloni [this message]
2017-10-26 14:07 ` Dan Carpenter
2017-10-26 14:50 ` Alexandre Belloni
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=20171026134852.bprrrv3htfyryyy4@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=balbi@ti.com \
--cc=dannenberg@ti.com \
--cc=elfring@users.sourceforge.net \
--cc=javier@osg.samsung.com \
--cc=jic23@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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