From c542b53da9ffa4fe9de61149818a06aacae531f8 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Fri, 19 Jul 2013 16:07:21 +0900 Subject: EDAC: Replace strict_strtol() with kstrtol() The usage of strict_strtol() is not preferred, because strict_strtol() is obsolete. Thus, kstrtol() should be used. Signed-off-by: Jingoo Han Signed-off-by: Borislav Petkov diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index ef15a7e..e6789e9 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -58,8 +58,10 @@ static int edac_set_poll_msec(const char *val, struct kernel_param *kp) if (!val) return -EINVAL; - ret = strict_strtol(val, 0, &l); - if (ret == -EINVAL || ((int)l != l)) + ret = kstrtol(val, 0, &l); + if (ret) + return ret; + if ((int)l != l) return -EINVAL; *((int *)kp->arg) = l; -- cgit v0.10.2 From f0a56c480196a98479760862468cc95879df3de0 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Tue, 23 Jul 2013 20:01:23 +0200 Subject: amd64_edac: Fix single-channel setups It can happen that configurations are running in a single-channel mode even with a dual-channel memory controller, by, say, putting the DIMMs only on the one channel and leaving the other empty. This causes a problem in init_csrows which implicitly assumes that when the second channel is enabled, i.e. channel 1, the struct dimm hierarchy will be present. Which is not. So always allocate two channels unconditionally. This provides for the nice side effect that the data structures are initialized so some day, when memory hotplug is supported, it should just work out of the box when all of a sudden a second channel appears. Reported-and-tested-by: Roger Leigh Signed-off-by: Borislav Petkov diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 8b6a034..8b3d901 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2470,8 +2470,15 @@ static int amd64_init_one_instance(struct pci_dev *F2) layers[0].size = pvt->csels[0].b_cnt; layers[0].is_virt_csrow = true; layers[1].type = EDAC_MC_LAYER_CHANNEL; - layers[1].size = pvt->channel_count; + + /* + * Always allocate two channels since we can have setups with DIMMs on + * only one channel. Also, this simplifies handling later for the price + * of a couple of KBs tops. + */ + layers[1].size = 2; layers[1].is_virt_csrow = false; + mci = edac_mc_alloc(nid, ARRAY_SIZE(layers), layers, 0); if (!mci) goto err_siblings; -- cgit v0.10.2 From 166e9334e9a716cf20c9c367b9bd28e13bb8608e Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Fri, 9 Aug 2013 18:02:45 +0900 Subject: i3200_edac: Make a local function static This local symbol is used only in this file. Fix the following sparse warnings: drivers/edac/i3200_edac.c:264:14: warning: symbol 'i3200_map_mchbar' was not declared. Should it be static? Signed-off-by: Jingoo Han Signed-off-by: Borislav Petkov diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c index aa44c17..be10a74 100644 --- a/drivers/edac/i3200_edac.c +++ b/drivers/edac/i3200_edac.c @@ -260,8 +260,7 @@ static void i3200_check(struct mem_ctl_info *mci) i3200_process_error_info(mci, &info); } - -void __iomem *i3200_map_mchbar(struct pci_dev *pdev) +static void __iomem *i3200_map_mchbar(struct pci_dev *pdev) { union { u64 mchbar; -- cgit v0.10.2 From e0d391ab04910aa1304f181fc865471a1d1508ec Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Fri, 9 Aug 2013 18:03:48 +0900 Subject: x38_edac: Make a local function static Make a local function static in order to fix the following sparse warning: drivers/edac/x38_edac.c:252:14: warning: symbol 'x38_map_mchbar' was not declared. Should it be static? Signed-off-by: Jingoo Han [ Boris: Correct commit message ] Signed-off-by: Borislav Petkov diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c index c9db24d..1a4df82 100644 --- a/drivers/edac/x38_edac.c +++ b/drivers/edac/x38_edac.c @@ -248,8 +248,7 @@ static void x38_check(struct mem_ctl_info *mci) x38_process_error_info(mci, &info); } - -void __iomem *x38_map_mchbar(struct pci_dev *pdev) +static void __iomem *x38_map_mchbar(struct pci_dev *pdev) { union { u64 mchbar; -- cgit v0.10.2 From 75a9551f2b3792686df25501f248d1de92d5da0f Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 12 Aug 2013 11:54:57 +0900 Subject: cpc925_edac: Use proper array termination The struct should be terminated by using empty braces in order to fix the following sparse warning. drivers/edac/cpc925_edac.c:792:10: warning: Using plain integer as NULL pointer Signed-off-by: Jingoo Han [ drop obvious comment ] Signed-off-by: Borislav Petkov diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c index 7f3c571..df6575f 100644 --- a/drivers/edac/cpc925_edac.c +++ b/drivers/edac/cpc925_edac.c @@ -789,7 +789,7 @@ static struct cpc925_dev_info cpc925_devs[] = { .exit = cpc925_htlink_exit, .check = cpc925_htlink_check, }, - {0}, /* Terminated by NULL */ + { } }; /* -- cgit v0.10.2