From: "F.A.Sulaiman" <asha.16@itfac.mrt.ac.lk>
To: airlied@redhat.com, sean@poorly.run, airlied@linux.ie, daniel@ffwll.ch
Cc: "F.A.Sulaiman" <asha.16@itfac.mrt.ac.lk>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] GPU:DRM: returning ENOMEM
Date: Mon, 30 Aug 2021 21:32:07 +0530 [thread overview]
Message-ID: <20210830160207.23936-1-asha.16@itfac.mrt.ac.lk> (raw)
In-Reply-To: <20210828154027.8198-1-asha.16@itfac.mrt.ac.lk>
check the return value and pass the proper error code.
Signed-off-by: F.A. SULAIMAN <asha.16@itfac.mrt.ac.lk>
---
drivers/gpu/drm/udl/udl_connector.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index cdc1c42e1669..857d2c97ef0e 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -23,7 +23,7 @@ static int udl_get_edid_block(void *data, u8 *buf, unsigned int block,
read_buff = kmalloc(2, GFP_KERNEL);
if (!read_buff)
- return -1;
+ return -ENOMEM;
for (i = 0; i < len; i++) {
int bval = (i + block * EDID_LENGTH) << 8;
@@ -31,11 +31,16 @@ static int udl_get_edid_block(void *data, u8 *buf, unsigned int block,
usb_rcvctrlpipe(udl->udev, 0),
(0x02), (0x80 | (0x02 << 5)), bval,
0xA1, read_buff, 2, HZ);
- if (ret < 1) {
+ if (ret == 0) {
+ DRM_ERROR("Reading EDID block %d returned empty result\n", i);
+ kfree(read_buff);
+ return -EINVAL;
+ } else if (ret < 0) {
DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret);
kfree(read_buff);
- return -1;
+ return ret;
}
+
buf[i] = read_buff[1];
}
--
2.17.1
next prev parent reply other threads:[~2021-08-30 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-28 15:40 [PATCH] GPU:drm: " F.A.Sulaiman
2021-08-30 16:02 ` F.A.Sulaiman [this message]
2021-08-30 16:06 ` [PATCH v2] GPU:DRM: " Simon Ser
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=20210830160207.23936-1-asha.16@itfac.mrt.ac.lk \
--to=asha.16@itfac.mrt.ac.lk \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sean@poorly.run \
/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
all inboxes | Powered by JetHome®