From patchwork Sun Dec 24 14:03:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kishore.p@techveda.org X-Patchwork-Id: 10132041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 793B160318 for ; Sun, 24 Dec 2017 14:04:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C5CF28E05 for ; Sun, 24 Dec 2017 14:04:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 610F728E08; Sun, 24 Dec 2017 14:04:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D5D6328E05 for ; Sun, 24 Dec 2017 14:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sHG8qR8qWmszDQSSebJDAT5E9DPzb61COM/Ly0OMsZ4=; b=crR/mYYApoALAcVfLwAuy1LpT4 zv5TxBPV/xbzpLZiZ7as9U4OHEx810lErkkmTzcEGCdnBYYnDfz1/r47W6JtC0xNbP+EDd2Kwf9xv +A/P2xzO8sXvpd2GqC6hYaETqKUVsrYrIhpgTfG5uJLNCCGwrGMRdL0w4DR1977iWz6k0jjqKNMKd UthuurKM0O+IfMnOnYX6vleWEGPaTak/Gx8CAT7i19SVKXhvQRBFoXEsdxazbMR13SO4Nxc9yU/C8 8Hqfuu1si89DEataOTDOSuv+G7OdQ9xDtkhrJd/8wOogybp7PehlL8ohakKIcpvA/bcAQJ68ZtNqQ +er43lqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eT6tV-0006ci-QB; Sun, 24 Dec 2017 14:04:49 +0000 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eT6tR-0006bE-Gm for linux-arm-kernel@lists.infradead.org; Sun, 24 Dec 2017 14:04:47 +0000 Received: by mail-pl0-x244.google.com with SMTP id 62so14097343pld.7 for ; Sun, 24 Dec 2017 06:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=techveda-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XIMayCBUe1dMmSaOu6tGByYgMdxBmYG9zGpW740RcgY=; b=sm3XxSnU6jzu4AyY7Gg4kGeDD4dnm4qWMz980E80xkvNFk1EEavbgSgaXPTKrEHia8 KkWxRyxrPjy6X314FnXJBug6A+DXi4RczWRvnTvZP6cQUal1p+uKQ5QUGWe+tQEX+qKT xWoh1GDhzNWpBAAUJCKLIv6eRmdLdKAmSdCnIxnweuraHyKFAWjslHGGvgk7LxVkz6OW Z1pRhy0eO4CqmwR22ajt9wvnrPeR0u+b0zjt8oYUItnab2qz8S2xiYs1C0PLlMky4bdN ABN8lfuyWR+Ki6n8ABZj7WNsKVMh8S/+pAGWwmKB1LfJ8yF8hDWQhLcKGrUNhImZb030 6H6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XIMayCBUe1dMmSaOu6tGByYgMdxBmYG9zGpW740RcgY=; b=Ya6wUAW6hIOgZQWTZTOA0K483NXVnFhvbCAWszsZHo81KCDC8c8ZEOi5SVyi1FAJ/U u0y9LEvRA3SqQjV4wUQ38xq5gijfHH04CUyGNw4Q6GfuwFKkj0xRwp5lWiVwoudxhDm6 Ba4FNXwbcth/QPnZicoskqRbWzSL7fEpdATjR3OP3j0KYLLCtcpQdzIAhqkq4nDDe3YB QWPe7aUjvzrzYtWWF41tREOtRc1GFqUklKuXRwILHkk5P+wkQuu65dEubdeGz8osXA96 Ip8GdVPj/TEYj7lYINyYcvCXTyI1WNa5TEM0hte2AzXgnfJ+FuZwjiDYprXsIJz9bbD/ dbAw== X-Gm-Message-State: AKGB3mIsCRAzlTOi4WYAAo5rzRBIR1WYZDRXgl6PErC71qkNb3s++DwW MdHeLxOV0gbSP/moTk69oA/GfA== X-Google-Smtp-Source: ACJfBouCx+r9mhRugffjPL4QHkG30G0y3+LppbgiTiIwctDMdQ37vVha/P+iVQ15JTZJhEPibjdvmQ== X-Received: by 10.84.232.6 with SMTP id h6mr19631745plk.263.1514124273749; Sun, 24 Dec 2017 06:04:33 -0800 (PST) Received: from localhost.localdomain ([183.82.213.240]) by smtp.gmail.com with ESMTPSA id m11sm16625502pgt.56.2017.12.24.06.04.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Dec 2017 06:04:32 -0800 (PST) From: kishore.p@techveda.org To: eric@anholt.net, stefan.wahren@i2se.com, gregkh@linuxfoundation.org Subject: [PATCH v2] staging: vc04_services: Prefer WARN_ON_ONCE instead of if condition followed by BUG. Date: Sun, 24 Dec 2017 19:33:54 +0530 Message-Id: <1514124234-11205-1-git-send-email-kishore.p@techveda.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <397155882.297531.1514045090990@email.1und1.de> References: <397155882.297531.1514045090990@email.1und1.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171224_060445_619889_8E5BFC74 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, karthik@techveda.org, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, Kishore KP , Suniel Mahesh , linux-arm-kernel@lists.infradead.org, shrikant.maurya@techveda.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kishore KP Coccinelle suggested to use BUG_ON instead of if condition followed by BUG but BUG_ON should be used in situations where integrity of the system is no longer guaranteed. In this case, as suggested by Stefan Wahren, vchiq isn't critical. Since it is not critical, BUG_ON should be avoided. Replaced if condition followed by BUG with WARN_ON_ONCE. Signed-off-by: Kishore KP Signed-off-by: Suniel Mahesh --- Changes for v2: - Subject and Description modified a bit based on the suggestion by Stefan Wahren. --- Note: - Patch was compile tested and built(ARCH=arm) on linux-next (latest). - No build issues reported. --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 315b49c..f20cf88 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -224,8 +224,7 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) platform_state = (struct vchiq_2835_state *)state->platform_state; - if (!platform_state->inited) - BUG(); + WARN_ON_ONCE(!platform_state->inited); return &platform_state->arm_state; }