summaryrefslogtreecommitdiff
path: root/drivers/edac
diff options
context:
space:
mode:
authorRobert Richter <rrichter@marvell.com>2019-11-06 09:33:09 +0000
committerBorislav Petkov <bp@suse.de>2019-11-10 12:40:14 +0100
commitd260e8ff5195d3080cc11ae1f35cf4e6eb1a5d24 (patch)
tree88439ccc108c6c58d797d33dbe3aae011e4608f9 /drivers/edac
parentc498afaf7df87f44e7cb383c135baec52b5259be (diff)
EDAC/mc: Do not BUG_ON() in edac_mc_alloc()
No need to crash the system in case edac_mc_alloc() is called with invalid arguments, just warn and return. This would cause a checkpatch warning when touching the code later, so just fix it. Signed-off-by: Robert Richter <rrichter@marvell.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org> Cc: James Morse <james.morse@arm.com> Cc: Tony Luck <tony.luck@intel.com> Link: https://lkml.kernel.org/r/20191106093239.25517-5-rrichter@marvell.com
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/edac_mc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 88e24ece3e1e..6b3c4a65c9c8 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -323,7 +323,8 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
int i, j, row, chn, n, len;
bool per_rank = false;
- BUG_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0);
+ if (WARN_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0))
+ return NULL;
/*
* Calculate the total amount of dimms and csrows/cschannels while