From dda0b3bd1cbb66ee869d589f7d719f703d7c38a1 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 13 Jul 2012 14:52:48 +0200 Subject: [PATCH 1/3] can: flexcan: make flexcan_priv.devtype_data member point to const data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Acked-by: Uwe Kleine-König Signed-off-by: Marc Kleine-Budde --- drivers/net/can/flexcan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 81324a11a50f..1b6f5621ce89 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -192,7 +192,7 @@ struct flexcan_priv { struct clk *clk; struct flexcan_platform_data *pdata; - struct flexcan_devtype_data *devtype_data; + const struct flexcan_devtype_data *devtype_data; }; static struct flexcan_devtype_data fsl_p1010_devtype_data = { @@ -960,7 +960,7 @@ static const struct platform_device_id flexcan_id_table[] = { static int __devinit flexcan_probe(struct platform_device *pdev) { const struct of_device_id *of_id; - struct flexcan_devtype_data *devtype_data; + const struct flexcan_devtype_data *devtype_data; struct net_device *dev; struct flexcan_priv *priv; struct resource *mem; From 0e84eb0b8a04b95b66aae652f947cbadffc6a25c Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 13 Jul 2012 14:54:59 +0200 Subject: [PATCH 2/3] can: mpc5xxx_can: make data in mpc5xxx_can_probe const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Acked-by: Uwe Kleine-König Signed-off-by: Marc Kleine-Budde --- drivers/net/can/mscan/mpc5xxx_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index 5caa572d71e3..06adf881ea24 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -251,7 +251,7 @@ static struct of_device_id mpc5xxx_can_table[]; static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev) { const struct of_device_id *match; - struct mpc5xxx_can_data *data; + const struct mpc5xxx_can_data *data; struct device_node *np = ofdev->dev.of_node; struct net_device *dev; struct mscan_priv *priv; From da78b7998e365b3f90b2a1a55d3b6ba6cc0c5905 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 14 Jul 2012 18:43:04 +0200 Subject: [PATCH 3/3] can: softing: softing_main: ensure a consistent return value in error case Typically, the return value desired for the failure of a function with an integer return value is a negative integer. In these cases, the return value is sometimes a negative integer and sometimes 0, due to a subsequent initialization of the return variable within the loop. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @r exists@ identifier ret; position p; constant C; expression e1,e3,e4; statement S; @@ ret = -C ... when != ret = e3 when any if@p (...) S ... when any if (\(ret != 0\|ret < 0\|ret > 0\) || ...) { ... return ...; } ... when != ret = e3 when any *if@p (...) { ... when != ret = e4 return ret; } // Signed-off-by: Julia Lawall Acked-by: Kurt Van Dijck Signed-off-by: Marc Kleine-Budde --- drivers/net/can/softing/softing_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c index a7c77c744ee9..f2a221e7b968 100644 --- a/drivers/net/can/softing/softing_main.c +++ b/drivers/net/can/softing/softing_main.c @@ -826,12 +826,12 @@ static __devinit int softing_pdev_probe(struct platform_device *pdev) goto sysfs_failed; } - ret = -ENOMEM; for (j = 0; j < ARRAY_SIZE(card->net); ++j) { card->net[j] = netdev = softing_netdev_create(card, card->id.chip[j]); if (!netdev) { dev_alert(&pdev->dev, "failed to make can[%i]", j); + ret = -ENOMEM; goto netdev_failed; } priv = netdev_priv(card->net[j]);