From: Takashi Iwai <tiwai@suse.de>
To: dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>, Sean Paul <sean@poorly.run>,
Thomas Zimmermann <tzimmermann@suse.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] drm/udl: Replace BUG_ON() with WARN_ON()
Date: Thu, 4 Aug 2022 09:58:26 +0200 [thread overview]
Message-ID: <20220804075826.27036-5-tiwai@suse.de> (raw)
In-Reply-To: <20220804075826.27036-1-tiwai@suse.de>
BUG_ON() is a tasteless choice as a sanity check for a driver like UDL
that isn't really a core code. Replace with WARN_ON() and proper
error handling instead.
Tested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/gpu/drm/udl/udl_main.c | 3 ++-
drivers/gpu/drm/udl/udl_transfer.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c
index 47204b7eb10e..fdafbf8f3c3c 100644
--- a/drivers/gpu/drm/udl/udl_main.c
+++ b/drivers/gpu/drm/udl/udl_main.c
@@ -260,7 +260,8 @@ int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len)
struct udl_device *udl = to_udl(dev);
int ret;
- BUG_ON(len > udl->urbs.size);
+ if (WARN_ON(len > udl->urbs.size))
+ return -EINVAL;
urb->transfer_buffer_length = len; /* set to actual payload len */
ret = usb_submit_urb(urb, GFP_ATOMIC);
diff --git a/drivers/gpu/drm/udl/udl_transfer.c b/drivers/gpu/drm/udl/udl_transfer.c
index 971927669d6b..176ef2a6a731 100644
--- a/drivers/gpu/drm/udl/udl_transfer.c
+++ b/drivers/gpu/drm/udl/udl_transfer.c
@@ -220,7 +220,8 @@ int udl_render_hline(struct drm_device *dev, int log_bpp, struct urb **urb_ptr,
u8 *cmd = *urb_buf_ptr;
u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length;
- BUG_ON(!(log_bpp == 1 || log_bpp == 2));
+ if (WARN_ON(!(log_bpp == 1 || log_bpp == 2)))
+ return -EINVAL;
line_start = (u8 *) (front + byte_offset);
next_pixel = line_start;
--
2.35.3
next prev parent reply other threads:[~2022-08-04 7:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-04 7:58 [PATCH 0/4] drm/udl: Fix stray URBs and cleanup Takashi Iwai
2022-08-04 7:58 ` [PATCH 1/4] drm/udl: Replace semaphore with a simple wait queue Takashi Iwai
2022-08-04 7:58 ` [PATCH 2/4] drm/udl: Sync pending URBs at suspend / disconnect Takashi Iwai
2022-08-04 7:58 ` [PATCH 3/4] drm/udl: Kill pending URBs at suspend and disconnect Takashi Iwai
2022-08-09 7:13 ` Thomas Zimmermann
2022-08-09 7:15 ` Takashi Iwai
2022-08-09 7:41 ` Thomas Zimmermann
2022-08-09 9:03 ` Takashi Iwai
2022-08-09 9:13 ` Thomas Zimmermann
2022-08-09 9:19 ` Takashi Iwai
2022-08-16 13:55 ` Takashi Iwai
2022-08-16 14:01 ` Thomas Zimmermann
2022-08-16 14:10 ` Takashi Iwai
2022-08-04 7:58 ` Takashi Iwai [this message]
2022-08-05 12:21 ` [PATCH 0/4] drm/udl: Fix stray URBs and cleanup Thomas Zimmermann
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=20220804075826.27036-5-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sean@poorly.run \
--cc=tzimmermann@suse.de \
/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®