From: Joe Perches <joe@perches.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Antti Palosaari <crope@iki.fi>,
kernel-janitors@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/9] drivers/media/usb/airspy/airspy.c: drop unneeded goto
Date: Thu, 28 May 2015 14:32:34 -0700 [thread overview]
Message-ID: <1432848754.1556.25.camel@perches.com> (raw)
In-Reply-To: <1432846944-7122-2-git-send-email-Julia.Lawall@lip6.fr>
On Thu, 2015-05-28 at 23:02 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Delete jump to a label on the next line, when that label is not
> used elsewhere.
Seems sensible but:
> diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c
[]
> @@ -937,9 +937,6 @@ static int airspy_set_if_gain(struct airspy *s)
> ret = airspy_ctrl_msg(s, CMD_SET_VGA_GAIN, 0, s->if_gain->val,
> &u8tmp, 1);
> if (ret)
> - goto err;
> -err:
> - if (ret)
> dev_dbg(s->dev, "failed=%d\n", ret);
>
> return ret;
Ideally the function above this should also be modified
do drop the unnecessary double test of ret
static int airspy_set_mixer_gain(struct airspy *s)
{
int ret;
u8 u8tmp;
dev_dbg(s->dev, "mixer auto=%d->%d val=%d->%d\n",
s->mixer_gain_auto->cur.val, s->mixer_gain_auto->val,
s->mixer_gain->cur.val, s->mixer_gain->val);
ret = airspy_ctrl_msg(s, CMD_SET_MIXER_AGC, 0, s->mixer_gain_auto->val,
&u8tmp, 1);
if (ret)
goto err;
if (s->mixer_gain_auto->val == false) {
ret = airspy_ctrl_msg(s, CMD_SET_MIXER_GAIN, 0,
s->mixer_gain->val, &u8tmp, 1);
if (ret)
goto err;
}
err:
if (ret)
dev_dbg(s->dev, "failed=%d\n", ret);
return ret;
}
These could become something like:
static int airspy_set_mixer_gain(struct airspy *s)
{
int ret;
u8 u8tmp;
dev_dbg(s->dev, "mixer auto=%d->%d val=%d->%d\n",
s->mixer_gain_auto->cur.val, s->mixer_gain_auto->val,
s->mixer_gain->cur.val, s->mixer_gain->val);
ret = airspy_ctrl_msg(s, CMD_SET_MIXER_AGC, 0, s->mixer_gain_auto->val,
&u8tmp, 1);
if (ret)
goto err;
if (s->mixer_gain_auto->val == false) {
ret = airspy_ctrl_msg(s, CMD_SET_MIXER_GAIN, 0,
s->mixer_gain->val, &u8tmp, 1);
if (ret)
goto err;
}
return 0;
err:
dev_dbg(s->dev, "failed=%d\n", ret);
return ret;
}
next prev parent reply other threads:[~2015-05-28 21:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
2015-05-28 21:02 ` [PATCH 1/9] drivers/media/usb/airspy/airspy.c: " Julia Lawall
2015-05-28 21:32 ` Joe Perches [this message]
2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
2015-05-31 6:49 ` David Miller
2015-05-28 21:02 ` [PATCH 3/9] NFS: " Julia Lawall
2015-05-28 21:02 ` [PATCH 4/9] RDMA/ocrdma: " Julia Lawall
2015-05-28 21:02 ` [PATCH 5/9] wl1251: " Julia Lawall
2015-06-08 8:39 ` [5/9] " Kalle Valo
2015-05-28 21:02 ` [PATCH 6/9] ssb: " Julia Lawall
2015-05-28 21:02 ` [PATCH 7/9] drivers/media/tuners/e4000.c: " Julia Lawall
2015-05-28 21:02 ` [PATCH 8/9] staging/lustre/mdc: " Julia Lawall
2015-05-28 21:02 ` [PATCH 9/9] regmap: " Julia Lawall
2015-05-29 9:37 ` Mark Brown
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=1432848754.1556.25.camel@perches.com \
--to=joe@perches.com \
--cc=Julia.Lawall@lip6.fr \
--cc=crope@iki.fi \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
/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