From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754524AbdLXOEg (ORCPT ); Sun, 24 Dec 2017 09:04:36 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:46410 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751574AbdLXOEe (ORCPT ); Sun, 24 Dec 2017 09:04:34 -0500 X-Google-Smtp-Source: ACJfBouCx+r9mhRugffjPL4QHkG30G0y3+LppbgiTiIwctDMdQ37vVha/P+iVQ15JTZJhEPibjdvmQ== From: kishore.p@techveda.org To: eric@anholt.net, stefan.wahren@i2se.com, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, karthik@techveda.org, shrikant.maurya@techveda.org, Kishore KP , Suniel Mahesh 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> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: kishore.p@techveda.org (kishore.p at techveda.org) Date: Sun, 24 Dec 2017 19:33:54 +0530 Subject: [PATCH v2] staging: vc04_services: Prefer WARN_ON_ONCE instead of if condition followed by BUG. In-Reply-To: <397155882.297531.1514045090990@email.1und1.de> References: <397155882.297531.1514045090990@email.1und1.de> Message-ID: <1514124234-11205-1-git-send-email-kishore.p@techveda.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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; } -- 1.9.1