mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
To: abbotti@mev.co.uk
Cc: hsweeten@visionengravers.com, gregkh@linuxfoundation.org,
	geliangtang@163.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org,
	Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Subject: [PATCH 4/5] Staging: comedi: fix CHECK issue in ni_tio.c
Date: Thu, 10 Mar 2016 12:22:09 +0530	[thread overview]
Message-ID: <1457592730-14347-4-git-send-email-ravishankarkm32@gmail.com> (raw)
In-Reply-To: <1457592730-14347-1-git-send-email-ravishankarkm32@gmail.com>

This is a patch to the ni_tio.c file that fixes up a CHECK issues
found by the checkpatch.pl tool.

i.e. Avoid crashing the kernel - try using WARN_ON & recovery code
rather than BUG() or BUG_ON().

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
---
 drivers/staging/comedi/drivers/ni_tio.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index b74e44e..f006805 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -222,7 +222,7 @@ static uint64_t ni_tio_clock_period_ps(const struct ni_gpct *counter,
 		clock_period_ps *= 8;
 		break;
 	default:
-		BUG();
+		WARN_ON(1);
 		break;
 	}
 	return clock_period_ps;
@@ -304,7 +304,7 @@ static unsigned ni_m_series_clock_src_select(const struct ni_gpct *counter)
 		}
 		if (i <= NI_M_MAX_PFI_CHAN)
 			break;
-		BUG();
+		WARN_ON(1);
 		break;
 	}
 	clock_source |= ni_tio_clock_src_modifiers(counter);
@@ -361,7 +361,7 @@ static unsigned ni_660x_clock_src_select(const struct ni_gpct *counter)
 		}
 		if (i <= NI_660X_MAX_SRC_PIN)
 			break;
-		BUG();
+		WARN_ON(1);
 		break;
 	}
 	clock_source |= ni_tio_clock_src_modifiers(counter);
@@ -584,7 +584,7 @@ static unsigned ni_660x_clk_src(unsigned int clock_source)
 		if (i <= NI_660X_MAX_SRC_PIN)
 			break;
 		ni_660x_clock = 0;
-		BUG();
+		WARN_ON(1);
 		break;
 	}
 	return GI_SRC_SEL(ni_660x_clock);
@@ -643,7 +643,7 @@ static unsigned ni_m_clk_src(unsigned int clock_source)
 			break;
 		pr_err("invalid clock source 0x%lx\n",
 		       (unsigned long)clock_source);
-		BUG();
+		WARN_ON(1);
 		ni_m_series_clock = 0;
 		break;
 	}
@@ -946,7 +946,7 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned gate_index,
 		case ni_gpct_variant_660x:
 			return ni_660x_set_gate2(counter, gate_source);
 		default:
-			BUG();
+			WARN_ON(1);
 			break;
 		}
 		break;
@@ -1015,7 +1015,7 @@ static unsigned ni_660x_gate_to_generic_gate(unsigned gate)
 			if (gate == NI_660X_PIN_GATE_SEL(i))
 				return NI_GPCT_GATE_PIN_GATE_SELECT(i);
 		}
-		BUG();
+		WARN_ON(1);
 		break;
 	}
 	return 0;
@@ -1051,7 +1051,7 @@ static unsigned ni_m_gate_to_generic_gate(unsigned gate)
 			if (gate == NI_M_PFI_GATE_SEL(i))
 				return NI_GPCT_PFI_GATE_SELECT(i);
 		}
-		BUG();
+		WARN_ON(1);
 		break;
 	}
 	return 0;
@@ -1083,7 +1083,7 @@ static unsigned ni_660x_gate2_to_generic_gate(unsigned gate)
 			if (gate == NI_660X_UD_PIN_GATE2_SEL(i))
 				return NI_GPCT_UP_DOWN_PIN_GATE_SELECT(i);
 		}
-		BUG();
+		WARN_ON(1);
 		break;
 	}
 	return 0;
-- 
1.9.1

  parent reply	other threads:[~2016-03-10  6:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10  6:52 [PATCH 1/5] Staging: comedi: fix type issue in s626.c Ravishankar Karkala Mallikarjunayya
2016-03-10  6:52 ` [PATCH 2/5] Staging: comedi: fix WARNING " Ravishankar Karkala Mallikarjunayya
2016-03-10 10:42   ` Ian Abbott
2016-03-11  3:32   ` Greg KH
2016-03-10  6:52 ` [PATCH 3/5] " Ravishankar Karkala Mallikarjunayya
2016-03-10 10:42   ` Ian Abbott
2016-03-10  6:52 ` Ravishankar Karkala Mallikarjunayya [this message]
2016-03-10 10:42   ` [PATCH 4/5] Staging: comedi: fix CHECK issue in ni_tio.c Ian Abbott
2016-03-10  6:52 ` [PATCH 5/5] Staging: comedi: fix type " Ravishankar Karkala Mallikarjunayya
2016-03-10 10:42   ` Ian Abbott
2016-03-10 10:41 ` [PATCH 1/5] Staging: comedi: fix type issue in s626.c Ian Abbott
2016-03-11  3:32 ` Greg KH
2016-03-14 11:06 [PATCH 1/5] Staging: comedi: Fix type issues " Ravishankar Karkala Mallikarjunayya
2016-03-14 11:06 ` [PATCH 4/5] Staging: comedi: fix CHECK issue in ni_tio.c Ravishankar Karkala Mallikarjunayya

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=1457592730-14347-4-git-send-email-ravishankarkm32@gmail.com \
    --to=ravishankarkm32@gmail.com \
    --cc=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=geliangtang@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome