Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp184141imn; Thu, 4 Aug 2022 01:42:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR5vAzD0Ey8TypiQrqKCZx4yS+MUPlZxY/sPPZDaHju55+aTebD2hOGfu4uXHDEc56oDELEL X-Received: by 2002:a17:907:7daa:b0:730:b6cc:9939 with SMTP id oz42-20020a1709077daa00b00730b6cc9939mr641177ejc.401.1659602535634; Thu, 04 Aug 2022 01:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659602535; cv=none; d=google.com; s=arc-20160816; b=eqe1MzKL0etz8DAjEGWzcu3DmPY33e4Tcptj6yrjjAfARmsMnqubuYkmIRkXaWhKSa kQthHY9Mo0wgvzj+P9CWToHtGaXig6+r0kSEbPyahcb1La4qMO4ZXBXWLj4QUh3Dbc/t lzfgd3bvjaxK5aQr7A0NCLwGUIns4i02vKXDlYcpkbBPIgST6qsvJa+5iW/IIDYvOtRF pus2aAzxvsoMBpWjEY0TPCA75rAlyoYw4G3r+dh9twQ96pFCefbIk5hbbpcVN/ZZKQSw y1wOpTag5Elem5xivg80lCrTcpsubobNgDfBCnnE+YusANEp/4MRP05OiPvY9FsEskmV heXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=+aJIcRX12CfNWmDhGD9PCw8ypEASoL7YINCO6ZNUt78=; b=Xsx2Ns3jNpAIZYFjkEZKRpJpHQvLEVNxitCvIJIjdaBZolH5XWAkUy8xRfnZloq+UA OnrXu3qBkGhEMW+KDpT6ZuOcXuG4vuTgeQbcswhOu4S1xzTd3JcrJELswFFrj+H84ZjZ 7Clysb7nz9EU1BCCjjhUYMO0uC9pHbZYP+tNuPP93LkNxrmSu0XphsC2y8AGMbUDxAL/ 1UHsl4uUPusX+htmauqM1+L3nVmX1Lnydn/YI0ACbQHLbRpN7V4xpJZSQrcCcWYoqNh1 WsnG1YQQ0rqZOWWQS6Mije6JB6kK29G+p9kyAtpqxGVeDzHXktTsm2LoDznkilxZBUgL ae1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=p5iTtXqG; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f24-20020a50fe18000000b0043e6d8942a5si689774edt.41.2022.08.04.01.41.50; Thu, 04 Aug 2022 01:42:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=p5iTtXqG; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231965AbiHDH66 (ORCPT + 99 others); Thu, 4 Aug 2022 03:58:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239318AbiHDH6h (ORCPT ); Thu, 4 Aug 2022 03:58:37 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D216033A19 for ; Thu, 4 Aug 2022 00:58:35 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6909E35189; Thu, 4 Aug 2022 07:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659599914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+aJIcRX12CfNWmDhGD9PCw8ypEASoL7YINCO6ZNUt78=; b=p5iTtXqGIXcnnzh7pNf+eKpN+ntxtaYAjIYdG8H42boKTlZkf7rkPIJn/ZV1SkUQk+NxFr iAp5Werfj2BV9qjAH6+t2VXqaaok/qtAA3VL1zeyk7BtC/LlDralDCgtYwKuGccTg0RVPV zWYlQQr2UpzfkfGW6aa8TWmAtOJ4W8A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659599914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+aJIcRX12CfNWmDhGD9PCw8ypEASoL7YINCO6ZNUt78=; b=XUUT7iEl1HzRcVnz3dgJ+6J91Cdl26LkFiG+8nM6vEb8kmZOG5RorZq4BL+7g2BPHzhUIM 6eeTexZSd5LTW2Bw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3F8C713AE1; Thu, 4 Aug 2022 07:58:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YDevDip862IlJAAAMHmgww (envelope-from ); Thu, 04 Aug 2022 07:58:34 +0000 From: Takashi Iwai To: dri-devel@lists.freedesktop.org Cc: Dave Airlie , Sean Paul , Thomas Zimmermann , 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 Message-Id: <20220804075826.27036-5-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220804075826.27036-1-tiwai@suse.de> References: <20220804075826.27036-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Takashi Iwai --- 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