netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()
@ 2012-09-21  7:09 Wei Yongjun
  2012-09-21  7:14 ` Wolfgang Grandegger
  2012-09-21  8:09 ` Marc Kleine-Budde
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2012-09-21  7:09 UTC (permalink / raw)
  To: wg, mkl, grant.likely, rob.herring
  Cc: yongjun_wei, linux-can, netdev, devicetree-discuss

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function clk_get() returns ERR_PTR()
and never returns NULL pointer. The NULL test in the error
handling should be replaced with IS_ERR().

dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/net/can/mscan/mpc5xxx_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index 06adf88..524ef96 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -181,7 +181,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
 
 		if (!clock_name || !strcmp(clock_name, "sys")) {
 			sys_clk = clk_get(&ofdev->dev, "sys_clk");
-			if (!sys_clk) {
+			if (IS_ERR(sys_clk)) {
 				dev_err(&ofdev->dev, "couldn't get sys_clk\n");
 				goto exit_unmap;
 			}
@@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
 
 		if (clocksrc < 0) {
 			ref_clk = clk_get(&ofdev->dev, "ref_clk");
-			if (!ref_clk) {
+			if (IS_ERR(ref_clk)) {
 				dev_err(&ofdev->dev, "couldn't get ref_clk\n");
 				goto exit_unmap;
 			}



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()
  2012-09-21  7:09 [PATCH] can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock() Wei Yongjun
@ 2012-09-21  7:14 ` Wolfgang Grandegger
  2012-09-21  8:09 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Grandegger @ 2012-09-21  7:14 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: mkl, grant.likely, rob.herring, yongjun_wei, linux-can, netdev,
	devicetree-discuss

On 09/21/2012 09:09 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function clk_get() returns ERR_PTR()
> and never returns NULL pointer. The NULL test in the error
> handling should be replaced with IS_ERR().
> 
> dpatch engine is used to auto generated this patch.
> (https://github.com/weiyj/dpatch)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Acked-by: Wolfgang Grandegger <wg@grandegger.com>

Thanks,

Wolfgang.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()
  2012-09-21  7:09 [PATCH] can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock() Wei Yongjun
  2012-09-21  7:14 ` Wolfgang Grandegger
@ 2012-09-21  8:09 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2012-09-21  8:09 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: wg, grant.likely, rob.herring, yongjun_wei, linux-can, netdev,
	devicetree-discuss

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

On 09/21/2012 09:09 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function clk_get() returns ERR_PTR()
> and never returns NULL pointer. The NULL test in the error
> handling should be replaced with IS_ERR().
> 
> dpatch engine is used to auto generated this patch.
> (https://github.com/weiyj/dpatch)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Applied to can-next

Tnx,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-21  8:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21  7:09 [PATCH] can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock() Wei Yongjun
2012-09-21  7:14 ` Wolfgang Grandegger
2012-09-21  8:09 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).