diff options
author | David S. Miller <davem@davemloft.net> | 2017-01-18 11:36:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-18 11:36:41 -0500 |
commit | 003ecadd2e5686d39630f89fa72102c28d91c475 (patch) | |
tree | 3d400732209054a870e2a82c385e5f4c59394402 | |
parent | 93b43fd137cd8865adf9978ab9870a344365d3af (diff) | |
parent | befa60113ce7ea270cb51eada28443ca2756f480 (diff) |
Merge tag 'linux-can-fixes-for-4.10-20170118' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says:
====================
pull-request: can 2017-01-18
this is a pull request for net/master consisting of two patches.
In the first patch Einar Jón fixes a NULL-pointer-deref in the c_can_pci
driver. In the second patch Yegor Yefremov fixes the clock handling in the
ti_hecc driver.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/can/c_can/c_can_pci.c | 1 | ||||
-rw-r--r-- | drivers/net/can/ti_hecc.c | 16 |
2 files changed, 13 insertions, 4 deletions
diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c index 7be393c96b1a..cf7c18947189 100644 --- a/drivers/net/can/c_can/c_can_pci.c +++ b/drivers/net/can/c_can/c_can_pci.c | |||
@@ -161,6 +161,7 @@ static int c_can_pci_probe(struct pci_dev *pdev, | |||
161 | 161 | ||
162 | dev->irq = pdev->irq; | 162 | dev->irq = pdev->irq; |
163 | priv->base = addr; | 163 | priv->base = addr; |
164 | priv->device = &pdev->dev; | ||
164 | 165 | ||
165 | if (!c_can_pci_data->freq) { | 166 | if (!c_can_pci_data->freq) { |
166 | dev_err(&pdev->dev, "no clock frequency defined\n"); | 167 | dev_err(&pdev->dev, "no clock frequency defined\n"); |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index 680d1ff07a55..6749b1829469 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
@@ -948,7 +948,12 @@ static int ti_hecc_probe(struct platform_device *pdev) | |||
948 | netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll, | 948 | netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll, |
949 | HECC_DEF_NAPI_WEIGHT); | 949 | HECC_DEF_NAPI_WEIGHT); |
950 | 950 | ||
951 | clk_enable(priv->clk); | 951 | err = clk_prepare_enable(priv->clk); |
952 | if (err) { | ||
953 | dev_err(&pdev->dev, "clk_prepare_enable() failed\n"); | ||
954 | goto probe_exit_clk; | ||
955 | } | ||
956 | |||
952 | err = register_candev(ndev); | 957 | err = register_candev(ndev); |
953 | if (err) { | 958 | if (err) { |
954 | dev_err(&pdev->dev, "register_candev() failed\n"); | 959 | dev_err(&pdev->dev, "register_candev() failed\n"); |
@@ -981,7 +986,7 @@ static int ti_hecc_remove(struct platform_device *pdev) | |||
981 | struct ti_hecc_priv *priv = netdev_priv(ndev); | 986 | struct ti_hecc_priv *priv = netdev_priv(ndev); |
982 | 987 | ||
983 | unregister_candev(ndev); | 988 | unregister_candev(ndev); |
984 | clk_disable(priv->clk); | 989 | clk_disable_unprepare(priv->clk); |
985 | clk_put(priv->clk); | 990 | clk_put(priv->clk); |
986 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 991 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
987 | iounmap(priv->base); | 992 | iounmap(priv->base); |
@@ -1006,7 +1011,7 @@ static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state) | |||
1006 | hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR); | 1011 | hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR); |
1007 | priv->can.state = CAN_STATE_SLEEPING; | 1012 | priv->can.state = CAN_STATE_SLEEPING; |
1008 | 1013 | ||
1009 | clk_disable(priv->clk); | 1014 | clk_disable_unprepare(priv->clk); |
1010 | 1015 | ||
1011 | return 0; | 1016 | return 0; |
1012 | } | 1017 | } |
@@ -1015,8 +1020,11 @@ static int ti_hecc_resume(struct platform_device *pdev) | |||
1015 | { | 1020 | { |
1016 | struct net_device *dev = platform_get_drvdata(pdev); | 1021 | struct net_device *dev = platform_get_drvdata(pdev); |
1017 | struct ti_hecc_priv *priv = netdev_priv(dev); | 1022 | struct ti_hecc_priv *priv = netdev_priv(dev); |
1023 | int err; | ||
1018 | 1024 | ||
1019 | clk_enable(priv->clk); | 1025 | err = clk_prepare_enable(priv->clk); |
1026 | if (err) | ||
1027 | return err; | ||
1020 | 1028 | ||
1021 | hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR); | 1029 | hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR); |
1022 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 1030 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |