From: William Breathitt Gray <vilhelm.gray@gmail.com>
To: Tim Gardner <tim.gardner@canonical.com>
Cc: dri-devel@lists.freedesktop.org,
Syed Nayyar Waris <syednwaris@gmail.com>,
Andrzej Hajda <a.hajda@samsung.com>,
Neil Armstrong <narmstrong@baylibre.com>,
Robert Foss <robert.foss@linaro.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/bridge: parade-ps8640: check return values in ps8640_aux_transfer()
Date: Sat, 25 Sep 2021 09:45:14 +0900 [thread overview]
Message-ID: <YU5xGn6i2a7vjajI@shinobu> (raw)
In-Reply-To: <8cdae251-f75e-bde8-a53d-27c77ac624c3@canonical.com>
[-- Attachment #1: Type: text/plain, Size: 3582 bytes --]
On Fri, Sep 24, 2021 at 10:03:27AM -0600, Tim Gardner wrote:
>
>
> On 9/24/21 9:26 AM, Tim Gardner wrote:
> > Coverity complains of an unused return code:
> >
> > CID 120459 (#1 of 1): Unchecked return value (CHECKED_RETURN)
> > 7. check_return: Calling regmap_bulk_write without checking return value (as is
> > done elsewhere 199 out of 291 times).
> > 204 regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len,
> > 205 ARRAY_SIZE(addr_len));
> >
> > While I was at it I noticed 2 other places where return codes were not being
> > used, or used incorrectly (which is a real bug).
> >
> > Fix these errors by correctly using the returned error codes.
> >
> > Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
> > Cc: Syed Nayyar Waris <syednwaris@gmail.com>
> > Cc: Andrzej Hajda <a.hajda@samsung.com>
> > Cc: Neil Armstrong <narmstrong@baylibre.com>
> > Cc: Robert Foss <robert.foss@linaro.org>
> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> > Cc: Jonas Karlman <jonas@kwiboo.se>
> > Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: linux-iio@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> > ---
> > drivers/gpu/drm/bridge/parade-ps8640.c | 14 +++++++++++---
> > 1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
> > index 3aaa90913bf8..591da962970a 100644
> > --- a/drivers/gpu/drm/bridge/parade-ps8640.c
> > +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> > @@ -201,8 +201,12 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux,
> > addr_len[PAGE0_SWAUX_LENGTH - base] = (len == 0) ? SWAUX_NO_PAYLOAD :
> > ((len - 1) & SWAUX_LENGTH_MASK);
> >
> > - regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len,
> > + ret = regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len,
> > ARRAY_SIZE(addr_len));
> > + if (ret) {
> > + DRM_DEV_ERROR(dev, "failed to bulk write ADDR_7_0: %d\n", ret);
> > + return ret;
> > + }
> >
> > if (len && (request == DP_AUX_NATIVE_WRITE ||
> > request == DP_AUX_I2C_WRITE)) {
> > @@ -218,13 +222,17 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux,
> > }
> > }
> >
> > - regmap_write(map, PAGE0_SWAUX_CTRL, SWAUX_SEND);
> > + ret = regmap_write(map, PAGE0_SWAUX_CTRL, SWAUX_SEND);
> > + if (ret) {
> > + DRM_DEV_ERROR(dev, "failed to write SEND: %d\n", ret);
> > + return ret;
> > + }
> >
> > /* Zero delay loop because i2c transactions are slow already */
> > regmap_read_poll_timeout(map, PAGE0_SWAUX_CTRL, data,
> > !(data & SWAUX_SEND), 0, 50 * 1000);
> >
> > - regmap_read(map, PAGE0_SWAUX_STATUS, &data);
> > + ret = regmap_read(map, PAGE0_SWAUX_STATUS, &data);
> > if (ret) {
> > DRM_DEV_ERROR(dev, "failed to read PAGE0_SWAUX_STATUS: %d\n",
> > ret);
> >
>
> I forgot to mention this patch is for linux-next next-20210924.
>
> -----------
> Tim Gardner
> Canonical, Inc
Hi Tim,
For future patches, the git format-patch command has a useful option
'--base'. It will allow you to provide the base tree information for
users and maintainers so that they know where to apply the patch:
https://git-scm.com/docs/git-format-patch#_base_tree_information
Sincerely,
William Breathitt Gray
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-09-25 0:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 15:26 [PATCH] drm/bridge: parade-ps8640: check return values in ps8640_aux_transfer() Tim Gardner
2021-09-24 16:03 ` Tim Gardner
2021-09-25 0:45 ` William Breathitt Gray [this message]
2021-10-11 10:07 ` Robert Foss
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=YU5xGn6i2a7vjajI@shinobu \
--to=vilhelm.gray@gmail.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=a.hajda@samsung.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=robert.foss@linaro.org \
--cc=syednwaris@gmail.com \
--cc=tim.gardner@canonical.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;
as well as URLs for NNTP newsgroup(s).