From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] media: i2c: adv7511: remove open coded version of SMBus block read
Date: Wed, 27 Jan 2021 11:18:14 +0100 [thread overview]
Message-ID: <20210127101814.GB928@ninjato> (raw)
In-Reply-To: <1b3f4451-20e5-4f73-acab-d0deaa7ba63d@xs4all.nl>
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
Hi Hans,
> > - adv7511_edid_rd(sd, 256, &state->edid.data[segment * 256]);
> > + err = adv7511_edid_rd(sd, 256, &state->edid.data[segment * 256]);
> > adv7511_dbg_dump_edid(2, debug, sd, segment, &state->edid.data[segment * 256]);
>
> Only call adv7511_dbg_dump_edid if err >= 0.
Yes.
>
> > if (segment == 0) {
>
> Change condition to: err >= 0 && segment == 0
Yes.
>
> > state->edid.blocks = state->edid.data[0x7e] + 1;
> > v4l2_dbg(1, debug, sd, "%s: %d blocks in total\n", __func__, state->edid.blocks);
> > }
So I guarded the above block with an 'if (!err)' clause.
adv7511_edid_rd() returns either 0 or errno, so we can take the above
simpler condition.
> > - if (!edid_verify_crc(sd, segment) ||
> > - !edid_verify_header(sd, segment)) {
> > + if (err < 0 || !edid_verify_crc(sd, segment) || !edid_verify_header(sd, segment)) {
> > /* edid crc error, force reread of edid segment */
>
> Hmm, this comment is a bit out of date. Change to:
>
> /*
> * Couldn't read EDID or EDID has invalid content.
> * Force reread of EDID segment.
> */
I updated the comment but kept it a oneliner.
>
> > v4l2_err(sd, "%s: edid crc or header error\n", __func__);
>
> Only show this message if err >= 0. For err < 0 the adv7511_edid_rd() already
> logs an error.
Yes. I used 'if (!err)' again here.
Will resend in a minute, thanks for the review!
All the best,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-01-27 10:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-19 9:39 [PATCH 0/3] treewide: remove open coded SMBus block transfers Wolfram Sang
2021-01-19 9:39 ` [PATCH 1/3] media: i2c: adv7842: remove open coded version of SMBus block write Wolfram Sang
2021-01-25 9:56 ` Hans Verkuil
2021-01-19 9:39 ` [PATCH 2/3] media: i2c: adv7511: remove open coded version of SMBus block read Wolfram Sang
2021-01-25 10:05 ` Hans Verkuil
2021-01-27 10:18 ` Wolfram Sang [this message]
2021-01-19 9:39 ` [PATCH 3/3] ipmi: remove open coded version of SMBus block write Wolfram Sang
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=20210127101814.GB928@ninjato \
--to=wsa+renesas@sang-engineering.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@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).