edac: Fix error return code when edac_pci_add_device() or edac_device_add_device() fails
Subsystems (13)
v2 cover edac: Fix error return code when edac_pci_add_device() or edac_device_add_device() fails
v1 --> v2:
1. When edac_pci_add_device() fails, fix to return -ENODEV
2. When edac_device_add_device() fails, fix to return -ENXIO
3. Use 'ret' instead of 'res' to store the return value
Zhen Lei (3):
edac: Fix error return code when edac_pci_add_device() fails
edac: Fix error return code when edac_device_add_device() fails
edac: Use 'ret' instead of 'res' to store the return value
drivers/edac/altera_edac.c | 70 +++++++++++++++++---------------- drivers/edac/amd8111_edac.c | 2 + drivers/edac/armada_xp_edac.c | 8 ++-- drivers/edac/cpc925_edac.c | 16 ++++---- drivers/edac/fsl_ddr_edac.c | 24 +++++------ drivers/edac/highbank_l2_edac.c | 22 ++++++----- drivers/edac/highbank_mc_edac.c | 20 +++++----- drivers/edac/layerscape_edac.c | 8 ++-- drivers/edac/mpc85xx_edac.c | 46 +++++++++++----------- drivers/edac/octeon_edac-pci.c | 9 +---- drivers/edac/qcom_edac.c | 4 +- drivers/edac/skx_base.c | 6 +-- drivers/edac/thunderx_edac.c | 28 +++++++------ drivers/edac/xgene_edac.c | 6 +-- 14 files changed, 138 insertions(+), 131 deletions(-)
Signature · 1 line
2.26.0.106.g9fadedd
PATCH v2 1/3 edac: Fix error return code when edac_pci_add_device() fails
When edac_pci_add_device() fails, fix to return -ENODEV from the error handling case instead of 0.
The "goto err" in octeon_pci_probe() is removed to simplify code.
--- drivers/edac/amd8111_edac.c | 1 + drivers/edac/mpc85xx_edac.c | 1 + drivers/edac/octeon_edac-pci.c | 9 ++------- 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/edac/amd8111_edac.c +1 -0
@@ -480,6 +480,7 @@ static int amd8111_pci_probe(struct pci_dev *dev,if (edac_pci_add_device (pci_info->edac_dev, pci_info->edac_idx) >0 ) {printk (KERN_ERR "failed to add edac_pci for %s\n" , pci_info->ctl_name); + ret = -ENODEV ; goto err_edac_free_ctl; }
drivers/edac/mpc85xx_edac.c +1 -0
@@ -248,6 +248,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)if (edac_pci_add_device (pci, pdata->edac_idx) >0 ) {edac_dbg (3 ,"failed edac_pci_add_device()\n" ); + res = -ENODEV ; goto err; }
drivers/edac/octeon_edac-pci.c +2 -7
@@ -60,7 +60,6 @@ static void octeon_pci_poll(struct edac_pci_ctl_info *pci)static int octeon_pci_probe (struct platform_device *pdev) {struct edac_pci_ctl_info *pci; -int res =0 ; pci =edac_pci_alloc_ctl_info (0 ,"octeon_pci_err" );if (!pci)
@@ -76,15 +75,11 @@ static int octeon_pci_probe(struct platform_device *pdev)if (edac_pci_add_device (pci,0 ) >0 ) {pr_err ("%s: edac_pci_add_device() failed\n" , __func__); - goto err; +edac_pci_free_ctl_info (pci); +return -ENODEV ; }return 0 ; - -err: -edac_pci_free_ctl_info (pci); - -return res; }static int octeon_pci_remove (struct platform_device *pdev)
Signature · 1 line
2.26.0.106.g9fadedd
PATCH v2 2/3 edac: Fix error return code when edac_device_add_device() fails
In reply to Zhen LeiWhen edac_device_add_device() fails, fix to return -ENXIO from the error handling case instead of 0, -ENOMEM or -EINVAL.
--- drivers/edac/altera_edac.c | 8 +++++--- drivers/edac/amd8111_edac.c | 1 + drivers/edac/armada_xp_edac.c | 2 +- drivers/edac/highbank_l2_edac.c | 4 +++- drivers/edac/mpc85xx_edac.c | 1 + drivers/edac/qcom_edac.c | 4 +++- drivers/edac/thunderx_edac.c | 2 ++ drivers/edac/xgene_edac.c | 6 +++--- 8 files changed, 19 insertions(+), 9 deletions(-)
drivers/edac/altera_edac.c +5 -3
@@ -784,8 +784,10 @@ static int altr_edac_device_probe(struct platform_device *pdev) dci->dev_name = drvdata->edac_dev_name; res =edac_device_add_device (dci); -if (res) +if (res) { + res = -ENXIO ; goto fail1; + }altr_create_edacdev_dbgfs (dci, drvdata->data);
@@ -1555,7 +1557,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)if (rc) {edac_printk (KERN_ERR ,EDAC_DEVICE ,"edac_device_add_device portB failed\n" ); - rc = -ENOMEM ; + rc = -ENXIO ; goto err_release_group_1; }altr_create_edacdev_dbgfs (dci, prv);
@@ -1963,7 +1965,7 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac, rc =edac_device_add_device (dci);if (rc) {dev_err (edac->dev,"edac_device_add_device failed\n" ); - rc = -ENOMEM ; + rc = -ENXIO ; goto err_release_group1; }
drivers/edac/amd8111_edac.c +1 -0
@@ -388,6 +388,7 @@ static int amd8111_dev_probe(struct pci_dev *dev,if (edac_device_add_device (dev_info->edac_dev) >0 ) {printk (KERN_ERR "failed to add edac_dev for %s\n" , dev_info->ctl_name); + ret = -ENXIO ; goto err_edac_free_ctl; }
drivers/edac/armada_xp_edac.c +1 -1
@@ -558,7 +558,7 @@ static int aurora_l2_probe(struct platform_device *pdev)if (edac_device_add_device (dci)) {edac_device_free_ctl_info (dci); -return -EINVAL ; +return -ENXIO ; }#ifdef CONFIG_EDAC_DEBUG
drivers/edac/highbank_l2_edac.c +3 -1
@@ -90,8 +90,10 @@ static int highbank_l2_err_probe(struct platform_device *pdev) dci->ctl_name = id ? id->compatible :"unknown" ; dci->dev_name =dev_name (&pdev->dev); -if (edac_device_add_device (dci)) +if (edac_device_add_device (dci)) { + res = -ENXIO ; goto err; + } drvdata->db_irq =platform_get_irq (pdev,0 ); res = devm_request_irq(&pdev->dev, drvdata->db_irq,
drivers/edac/mpc85xx_edac.c +1 -0
@@ -553,6 +553,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)if (edac_device_add_device (edac_dev) >0 ) {edac_dbg (3 ,"failed edac_device_add_device()\n" ); + res = -ENXIO ; goto err; }
drivers/edac/qcom_edac.c +3 -1
@@ -361,8 +361,10 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev) edev_ctl->pvt_info = llcc_driv_data; rc =edac_device_add_device (edev_ctl); -if (rc) +if (rc) { + rc = -ENXIO ; goto out_mem; + }platform_set_drvdata (pdev, edev_ctl);
drivers/edac/thunderx_edac.c +2 -0
@@ -1421,6 +1421,7 @@ static int thunderx_ocx_probe(struct pci_dev *pdev, ret =edac_device_add_device (edac_dev);if (ret) {dev_err (&pdev->dev,"Cannot add EDAC device: %d\n" , ret); + ret = -ENXIO ; goto err_free; }
@@ -2051,6 +2052,7 @@ static int thunderx_l2c_probe(struct pci_dev *pdev, ret =edac_device_add_device (edac_dev);if (ret) {dev_err (&pdev->dev,"Cannot add EDAC device: %d\n" , ret); + ret = -ENXIO ; goto err_free; }
drivers/edac/xgene_edac.c +3 -3
@@ -953,7 +953,7 @@ static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np, rc =edac_device_add_device (edac_dev);if (rc >0 ) {dev_err (edac->dev,"edac_device_add_device failed\n" ); - rc = -ENOMEM ; + rc = -ENXIO ; goto err_free; }
@@ -1236,7 +1236,7 @@ static int xgene_edac_l3_add(struct xgene_edac *edac, struct device_node *np, rc =edac_device_add_device (edac_dev);if (rc >0 ) {dev_err (edac->dev,"failed edac_device_add_device()\n" ); - rc = -ENOMEM ; + rc = -ENXIO ; goto err_ctl_free; }
@@ -1774,7 +1774,7 @@ static int xgene_edac_soc_add(struct xgene_edac *edac, struct device_node *np, rc =edac_device_add_device (edac_dev);if (rc >0 ) {dev_err (edac->dev,"failed edac_device_add_device()\n" ); - rc = -ENOMEM ; + rc = -ENXIO ; goto err_ctl_free; }
Signature · 1 line
2.26.0.106.g9fadedd
PATCH v2 3/3 edac: Use 'ret' instead of 'res' to store the return value
In reply to Zhen LeiUsually 'ret' or 'rc' is used as the abbreviation for 'return code', and 'res' is used as the abbreviation for 'resource'.
--- drivers/edac/altera_edac.c | 66 ++++++++++++++++----------------- drivers/edac/armada_xp_edac.c | 6 +-- drivers/edac/cpc925_edac.c | 16 ++++---- drivers/edac/fsl_ddr_edac.c | 24 ++++++------ drivers/edac/highbank_l2_edac.c | 20 +++++----- drivers/edac/highbank_mc_edac.c | 20 +++++----- drivers/edac/layerscape_edac.c | 8 ++-- drivers/edac/mpc85xx_edac.c | 48 ++++++++++++------------ drivers/edac/skx_base.c | 6 +-- drivers/edac/thunderx_edac.c | 26 ++++++------- 10 files changed, 120 insertions(+), 120 deletions(-)
drivers/edac/altera_edac.c +33 -33
@@ -286,7 +286,7 @@ static int altr_sdram_probe(struct platform_device *pdev)struct regmap *mc_vbase;struct dimm_info *dimm;u32 read_reg; -int irq, irq2, res =0 ; +int irq, irq2, ret =0 ;unsigned long mem_size, irqflags =0 ; id =of_match_device (altr_sdram_ctrl_of_match, &pdev->dev);
@@ -375,7 +375,7 @@ static int altr_sdram_probe(struct platform_device *pdev)if (!devres_open_group (&pdev->dev,NULL ,GFP_KERNEL )) {edac_printk (KERN_ERR ,EDAC_MC ,"Unable to get managed device resource\n" ); - res = -ENOMEM ; + ret = -ENOMEM ; goto free; }
@@ -394,40 +394,40 @@ static int altr_sdram_probe(struct platform_device *pdev) dimm->mtype =MEM_DDR3 ; dimm->edac_mode =EDAC_SECDED ; - res =edac_mc_add_mc (mci); -if (res <0 ) + ret =edac_mc_add_mc (mci); +if (ret <0 ) goto err;/* Only the Arria10 has separate IRQs */ if (of_machine_is_compatible ("altr,socfpga-arria10" )) {/* Arria10 specific initialization */ - res =a10_init (mc_vbase); -if (res <0 ) + ret =a10_init (mc_vbase); +if (ret <0 ) goto err2; - res =devm_request_irq (&pdev->dev, irq2, + ret =devm_request_irq (&pdev->dev, irq2, altr_sdram_mc_err_handler,IRQF_SHARED ,dev_name (&pdev->dev), mci); -if (res <0 ) { +if (ret <0 ) {edac_mc_printk (mci,KERN_ERR ,"Unable to request irq %d\n" , irq2); - res = -ENODEV ; + ret = -ENODEV ; goto err2; } - res =a10_unmask_irq (pdev,A10_DDR0_IRQ_MASK ); -if (res <0 ) + ret =a10_unmask_irq (pdev,A10_DDR0_IRQ_MASK ); +if (ret <0 ) goto err2; irqflags =IRQF_SHARED ; } - res =devm_request_irq (&pdev->dev, irq, altr_sdram_mc_err_handler, + ret =devm_request_irq (&pdev->dev, irq, altr_sdram_mc_err_handler, irqflags,dev_name (&pdev->dev), mci); -if (res <0 ) { +if (ret <0 ) {edac_mc_printk (mci,KERN_ERR ,"Unable to request irq %d\n" , irq); - res = -ENODEV ; + ret = -ENODEV ; goto err2; }
@@ -436,7 +436,7 @@ static int altr_sdram_probe(struct platform_device *pdev) priv->ecc_irq_en_mask, priv->ecc_irq_en_mask)) {edac_mc_printk (mci,KERN_ERR ,"Error enabling SDRAM ECC IRQ\n" ); - res = -ENODEV ; + ret = -ENODEV ; goto err2; }
@@ -453,9 +453,9 @@ static int altr_sdram_probe(struct platform_device *pdev) free:edac_mc_free (mci);edac_printk (KERN_ERR ,EDAC_MC , -"EDAC Probe Failed; Error %d\n" , res); +"EDAC Probe Failed; Error %d\n" , ret); -return res; +return ret; }static int altr_sdram_remove (struct platform_device *pdev)
@@ -707,7 +707,7 @@ static int altr_edac_device_probe(struct platform_device *pdev)struct edac_device_ctl_info *dci;struct altr_edac_device_dev *drvdata;struct resource *r; -int res =0 ; +int ret =0 ;struct device_node *np = pdev->dev.of_node;char *ecc_name = (char *)np->name;static int dev_instance;
@@ -722,7 +722,7 @@ static int altr_edac_device_probe(struct platform_device *pdev)if (!r) {edac_printk (KERN_ERR ,EDAC_DEVICE ,"Unable to get mem resource\n" ); - res = -ENODEV ; + ret = -ENODEV ; goto fail; }
@@ -730,7 +730,7 @@ static int altr_edac_device_probe(struct platform_device *pdev) dev_name(&pdev->dev))) {edac_printk (KERN_ERR ,EDAC_DEVICE ,"%s:Error requesting mem region\n" , ecc_name); - res = -EBUSY ; + ret = -EBUSY ; goto fail; }
@@ -741,7 +741,7 @@ static int altr_edac_device_probe(struct platform_device *pdev)if (!dci) {edac_printk (KERN_ERR ,EDAC_DEVICE ,"%s: Unable to allocate EDAC device\n" , ecc_name); - res = -ENOMEM ; + ret = -ENOMEM ; goto fail; }
@@ -752,7 +752,7 @@ static int altr_edac_device_probe(struct platform_device *pdev) drvdata->base =devm_ioremap (&pdev->dev, r->start,resource_size (r));if (!drvdata->base) { - res = -ENOMEM ; + ret = -ENOMEM ; goto fail1; }
@@ -761,31 +761,31 @@ static int altr_edac_device_probe(struct platform_device *pdev)/* Check specific dependencies for the module */ if (drvdata->data->setup) { - res = drvdata->data->setup (drvdata); -if (res) + ret = drvdata->data->setup (drvdata); +if (ret) goto fail1; } drvdata->sb_irq =platform_get_irq (pdev,0 ); - res =devm_request_irq (&pdev->dev, drvdata->sb_irq, + ret =devm_request_irq (&pdev->dev, drvdata->sb_irq, altr_edac_device_handler,0 ,dev_name (&pdev->dev), dci); -if (res) +if (ret) goto fail1; drvdata->db_irq =platform_get_irq (pdev,1 ); - res =devm_request_irq (&pdev->dev, drvdata->db_irq, + ret =devm_request_irq (&pdev->dev, drvdata->db_irq, altr_edac_device_handler,0 ,dev_name (&pdev->dev), dci); -if (res) +if (ret) goto fail1; dci->mod_name ="Altera ECC Manager" ; dci->dev_name = drvdata->edac_dev_name; - res =edac_device_add_device (dci); -if (res) { - res = -ENXIO ; + ret =edac_device_add_device (dci); +if (ret) { + ret = -ENXIO ; goto fail1; }
@@ -800,9 +800,9 @@ static int altr_edac_device_probe(struct platform_device *pdev) fail:devres_release_group (&pdev->dev,NULL );edac_printk (KERN_ERR ,EDAC_DEVICE , -"%s:Error setting up EDAC device: %d\n" , ecc_name, res); +"%s:Error setting up EDAC device: %d\n" , ecc_name, ret); -return res; +return ret; }static int altr_edac_device_remove (struct platform_device *pdev)
drivers/edac/armada_xp_edac.c +3 -3
@@ -611,13 +611,13 @@ static struct platform_driver * const drivers[] = {static int __init armada_xp_edac_init (void ) { -int res; +int ret;/* only polling is supported */ edac_op_state =EDAC_OPSTATE_POLL ; - res =platform_register_drivers (drivers,ARRAY_SIZE (drivers)); -if (res) + ret =platform_register_drivers (drivers,ARRAY_SIZE (drivers)); +if (ret)pr_warn ("Armada XP EDAC drivers fail to register\n" );return 0 ;
drivers/edac/cpc925_edac.c +8 -8
@@ -911,19 +911,19 @@ static int cpc925_probe(struct platform_device *pdev)void __iomem *vbase;struct cpc925_mc_pdata *pdata;struct resource *r; -int res =0 , nr_channels; +int ret =0 , nr_channels;edac_dbg (0 ,"%s platform device found!\n" , pdev->name);if (!devres_open_group (&pdev->dev, cpc925_probe,GFP_KERNEL )) { - res = -ENOMEM ; + ret = -ENOMEM ; goto out; } r =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!r) {cpc925_printk (KERN_ERR ,"Unable to get resource\n" ); - res = -ENOENT ; + ret = -ENOENT ; goto err1; }
@@ -932,14 +932,14 @@ static int cpc925_probe(struct platform_device *pdev) resource_size(r), pdev->name)) {cpc925_printk (KERN_ERR ,"Unable to request mem region\n" ); - res = -EBUSY ; + ret = -EBUSY ; goto err1; } vbase =devm_ioremap (&pdev->dev, r->start,resource_size (r));if (!vbase) {cpc925_printk (KERN_ERR ,"Unable to ioremap device\n" ); - res = -ENOMEM ; + ret = -ENOMEM ; goto err2; }
@@ -955,7 +955,7 @@ static int cpc925_probe(struct platform_device *pdev) sizeof(struct cpc925_mc_pdata));if (!mci) {cpc925_printk (KERN_ERR ,"No memory for mem_ctl_info\n" ); - res = -ENOMEM ; + ret = -ENOMEM ; goto err2; }
@@ -996,7 +996,7 @@ static int cpc925_probe(struct platform_device *pdev)/* get this far and it's successful */ edac_dbg (0 ,"success\n" ); - res =0 ; + ret =0 ; goto out; err3:
@@ -1007,7 +1007,7 @@ static int cpc925_probe(struct platform_device *pdev) err1:devres_release_group (&pdev->dev, cpc925_probe); out: -return res; +return ret; }static int cpc925_remove (struct platform_device *pdev)
drivers/edac/fsl_ddr_edac.c +12 -12
@@ -480,7 +480,7 @@ int fsl_mc_err_probe(struct platform_device *op)struct fsl_mc_pdata *pdata;struct resource r;u32 sdram_ctl; -int res; +int ret;if (!devres_open_group (&op->dev, fsl_mc_err_probe,GFP_KERNEL ))return -ENOMEM ;
@@ -512,8 +512,8 @@ int fsl_mc_err_probe(struct platform_device *op)*/ little_endian =of_property_read_bool (op->dev.of_node,"little-endian" ); - res =of_address_to_resource (op->dev.of_node,0 , &r); -if (res) { + ret =of_address_to_resource (op->dev.of_node,0 , &r); +if (ret) {pr_err ("%s: Unable to get resource for MC err regs\n" , __func__); goto err;
@@ -523,14 +523,14 @@ int fsl_mc_err_probe(struct platform_device *op) pdata->name)) {pr_err ("%s: Error while requesting mem region\n" , __func__); - res = -EBUSY ; + ret = -EBUSY ; goto err; } pdata->mc_vbase =devm_ioremap (&op->dev, r.start,resource_size (&r));if (!pdata->mc_vbase) {pr_err ("%s: Unable to setup MC err regs\n" , __func__); - res = -ENOMEM ; + ret = -ENOMEM ; goto err; }
@@ -538,7 +538,7 @@ int fsl_mc_err_probe(struct platform_device *op)if (!(sdram_ctl &DSC_ECC_EN )) {/* no ECC */ pr_warn ("%s: No ECC DIMMs discovered\n" , __func__); - res = -ENODEV ; + ret = -ENODEV ; goto err; }
@@ -567,8 +567,8 @@ int fsl_mc_err_probe(struct platform_device *op)/* clear all error bits */ ddr_out32 (pdata->mc_vbase +FSL_MC_ERR_DETECT , ~0 ); - res =edac_mc_add_mc_with_groups (mci, fsl_ddr_dev_groups); -if (res) { + ret =edac_mc_add_mc_with_groups (mci, fsl_ddr_dev_groups); +if (ret) {edac_dbg (3 ,"failed edac_mc_add_mc()\n" ); goto err; }
@@ -586,14 +586,14 @@ int fsl_mc_err_probe(struct platform_device *op)/* register interrupts */ pdata->irq =platform_get_irq (op,0 ); - res =devm_request_irq (&op->dev, pdata->irq, + ret =devm_request_irq (&op->dev, pdata->irq, fsl_mc_isr,IRQF_SHARED ,"[EDAC] MC err" , mci); -if (res <0 ) { +if (ret <0 ) {pr_err ("%s: Unable to request irq %d for FSL DDR DRAM ERR\n" , __func__, pdata->irq); - res = -ENODEV ; + ret = -ENODEV ; goto err2; }
@@ -612,7 +612,7 @@ int fsl_mc_err_probe(struct platform_device *op) err:devres_release_group (&op->dev, fsl_mc_err_probe);edac_mc_free (mci); -return res; +return ret; }int fsl_mc_err_remove (struct platform_device *op)
drivers/edac/highbank_l2_edac.c +10 -10
@@ -50,7 +50,7 @@ static int highbank_l2_err_probe(struct platform_device *pdev)struct edac_device_ctl_info *dci;struct hb_l2_drvdata *drvdata;struct resource *r; -int res =0 ; +int ret =0 ; dci =edac_device_alloc_ctl_info (sizeof (*drvdata),"cpu" ,1 ,"L" ,1 ,2 ,NULL ,0 ,0 );
@@ -67,21 +67,21 @@ static int highbank_l2_err_probe(struct platform_device *pdev) r =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!r) {dev_err (&pdev->dev,"Unable to get mem resource\n" ); - res = -ENODEV ; + ret = -ENODEV ; goto err; }if (!devm_request_mem_region (&pdev->dev, r->start,resource_size (r),dev_name (&pdev->dev))) {dev_err (&pdev->dev,"Error while requesting mem region\n" ); - res = -EBUSY ; + ret = -EBUSY ; goto err; } drvdata->base =devm_ioremap (&pdev->dev, r->start,resource_size (r));if (!drvdata->base) {dev_err (&pdev->dev,"Unable to map regs\n" ); - res = -ENOMEM ; + ret = -ENOMEM ; goto err; }
@@ -91,22 +91,22 @@ static int highbank_l2_err_probe(struct platform_device *pdev) dci->dev_name =dev_name (&pdev->dev);if (edac_device_add_device (dci)) { - res = -ENXIO ; + ret = -ENXIO ; goto err; } drvdata->db_irq =platform_get_irq (pdev,0 ); - res =devm_request_irq (&pdev->dev, drvdata->db_irq, + ret =devm_request_irq (&pdev->dev, drvdata->db_irq, highbank_l2_err_handler,0 ,dev_name (&pdev->dev), dci); -if (res <0 ) +if (ret <0 ) goto err2; drvdata->sb_irq =platform_get_irq (pdev,1 ); - res =devm_request_irq (&pdev->dev, drvdata->sb_irq, + ret =devm_request_irq (&pdev->dev, drvdata->sb_irq, highbank_l2_err_handler,0 ,dev_name (&pdev->dev), dci); -if (res <0 ) +if (ret <0 ) goto err2;devres_close_group (&pdev->dev,NULL );
@@ -116,7 +116,7 @@ static int highbank_l2_err_probe(struct platform_device *pdev) err:devres_release_group (&pdev->dev,NULL );edac_device_free_ctl_info (dci); -return res; +return ret; }static int highbank_l2_err_remove (struct platform_device *pdev)
drivers/edac/highbank_mc_edac.c +10 -10
@@ -153,7 +153,7 @@ static int highbank_mc_probe(struct platform_device *pdev)void __iomem *base;u32 control;int irq; -int res =0 ; +int ret =0 ; id =of_match_device (hb_ddr_ctrl_of_match, &pdev->dev);if (!id)
@@ -180,21 +180,21 @@ static int highbank_mc_probe(struct platform_device *pdev) r =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!r) {dev_err (&pdev->dev,"Unable to get mem resource\n" ); - res = -ENODEV ; + ret = -ENODEV ; goto err; }if (!devm_request_mem_region (&pdev->dev, r->start,resource_size (r),dev_name (&pdev->dev))) {dev_err (&pdev->dev,"Error while requesting mem region\n" ); - res = -EBUSY ; + ret = -EBUSY ; goto err; } base =devm_ioremap (&pdev->dev, r->start,resource_size (r));if (!base) {dev_err (&pdev->dev,"Unable to map regs\n" ); - res = -ENOMEM ; + ret = -ENOMEM ; goto err; }
@@ -205,7 +205,7 @@ static int highbank_mc_probe(struct platform_device *pdev) control =readl (drvdata->mc_err_base +HB_DDR_ECC_OPT ) &0x3 ;if (!control || (control ==0x2 )) {dev_err (&pdev->dev,"No ECC present, or ECC disabled\n" ); - res = -ENODEV ; + ret = -ENODEV ; goto err; }
@@ -225,14 +225,14 @@ static int highbank_mc_probe(struct platform_device *pdev) dimm->mtype =MEM_DDR3 ; dimm->edac_mode =EDAC_SECDED ; - res =edac_mc_add_mc_with_groups (mci, highbank_dev_groups); -if (res <0 ) + ret =edac_mc_add_mc_with_groups (mci, highbank_dev_groups); +if (ret <0 ) goto err; irq =platform_get_irq (pdev,0 ); - res =devm_request_irq (&pdev->dev, irq, highbank_mc_err_handler, + ret =devm_request_irq (&pdev->dev, irq, highbank_mc_err_handler,0 ,dev_name (&pdev->dev), mci); -if (res <0 ) { +if (ret <0 ) {dev_err (&pdev->dev,"Unable to request irq %d\n" , irq); goto err2; }
@@ -244,7 +244,7 @@ static int highbank_mc_probe(struct platform_device *pdev) err:devres_release_group (&pdev->dev,NULL );edac_mc_free (mci); -return res; +return ret; }static int highbank_mc_remove (struct platform_device *pdev)
drivers/edac/layerscape_edac.c +4 -4
@@ -36,7 +36,7 @@ static struct platform_driver fsl_ddr_mc_err_driver = {static int __init fsl_ddr_mc_init (void ) { -int res; +int ret;/* make sure error reporting method is sane */ switch (edac_op_state) {
@@ -48,10 +48,10 @@ static int __init fsl_ddr_mc_init(void)break ; } - res =platform_driver_register (&fsl_ddr_mc_err_driver); -if (res) { + ret =platform_driver_register (&fsl_ddr_mc_err_driver); +if (ret) {pr_err ("MC fails to register\n" ); -return res; +return ret; }return 0 ;
drivers/edac/mpc85xx_edac.c +24 -24
159 lines not on this page · raw message
drivers/edac/skx_base.c +3 -3
@@ -530,11 +530,11 @@ static u8 skx_open_fine_column[] = {static int skx_bits (u64 addr,int nbits,u8 *bits) { -int i, res =0 ; +int i, ret =0 ;for (i =0 ; i < nbits; i++) - res |= ((addr >> bits[i]) &1 ) << i; -return res; + ret |= ((addr >> bits[i]) &1 ) << i; +return ret; }static int skx_bank_bits (u64 addr,int b0,int b1,int do_xor,int x0,int x1)
drivers/edac/thunderx_edac.c +13 -13
@@ -243,11 +243,11 @@ static ssize_t thunderx_##_type##_##_field##_write(struct file *file, \ size_t count, loff_t *ppos) \ { \ struct thunderx_##_type *pdata = file->private_data; \ -int res; \ +int ret; \ \ - res =kstrtoull_from_user (data, count,0 , &pdata->_field); \ + ret =kstrtoull_from_user (data, count,0 , &pdata->_field); \ \ -return res ? res : count; \ +return ret ? ret : count; \ } \ \ DEBUGFS_STRUCT(_field, 0600, \
@@ -273,16 +273,16 @@ static ssize_t thunderx_##_type##_##_name##_write(struct file *file, \ { \ struct thunderx_##_type *pdata = file->private_data; \u64 val; \ -int res; \ +int ret; \ \ - res =kstrtoull_from_user (data, count,0 , &val); \ + ret =kstrtoull_from_user (data, count,0 , &val); \ \ -if (!res) { \ +if (!ret) { \writeq (val, pdata->regs + _reg); \ - res = count; \ + ret = count; \ } \ \ -return res; \ +return ret; \ } \ \ DEBUGFS_STRUCT(_name, 0600, \
@@ -306,17 +306,17 @@ static ssize_t thunderx_lmc_inject_int_write(struct file *file, {struct thunderx_lmc *lmc = file->private_data;u64 val; -int res; +int ret; - res =kstrtoull_from_user (data, count,0 , &val); + ret =kstrtoull_from_user (data, count,0 , &val); -if (!res) { +if (!ret) {/* Trigger the interrupt */ writeq (val, lmc->regs +LMC_INT_W1S ); - res = count; + ret = count; } -return res; +return ret; } static ssize_t thunderx_lmc_int_read(struct file *file,
Signature · 1 line
2.26.0.106.g9fadedd
Borislav Petkov
maintainerRe: [PATCH v2 3/3] edac: Use 'ret' instead of 'res' to store the return value
Quoted 2 lines · Zhen Lei
Usually 'ret' or 'rc' is used as the abbreviation for 'return code', and 'res' is used as the abbreviation for 'resource'.
Or "result."
Please refrain from doing pointless patches like that - it is a totally unnecessary churn.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v2 3/3] edac: Use 'ret' instead of 'res' to store the return value
Quoted 5 lines · Borislav Petkov
Quoted 2 lines · Zhen Lei
Usually 'ret' or 'rc' is used as the abbreviation for 'return code', and 'res' is used as the abbreviation for 'resource'.
Or "result."
https://www.allacronyms.com/result/abbreviated
It seems 'res' is the right abbreviation for 'result'. But since people see 'res', it's easier to associate 'resource', it's probably better to use it sparingly. And it seems that 'ret' and 'rc' are used more frequently.
However, the greens and radishes have their own love. So I'm fine with ignoring this patch.
Quoted 3 lines
Please refrain from doing pointless patches like that - it is a totally unnecessary churn.
OK