linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: d binderman <dcb314@hotmail.com>
To: <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Subject: powermac/low_i2c.c: three minor problems
Date: Sat, 6 Feb 2010 12:13:29 +0000	[thread overview]
Message-ID: <BLU108-W1270106CF117770B0ABB269C530@phx.gbl> (raw)

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



Hello there,

I just ran the sourceforge tool cppcheck over the source code of the
new Linux kernel 2.6.33-rc6

It said

[./arch/powerpc/platforms/powermac/low_i2c.c:594]: (style) The scope of the variable chans can be reduced
[./arch/powerpc/platforms/powermac/low_i2c.c:594]: (style) The scope of the variable i can be reduced
[./arch/powerpc/platforms/powermac/low_i2c.c:1260]: (style) Redundant condition. It is safe to deallocate a NULL pointer

Please find attached a patch to fix these minor problems.  
The patched version compiles, but I have not been able to test it at run time.

Regards

David Binderman
 		 	   		  
_________________________________________________________________
Do you have a story that started on Hotmail? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bug30.patch --]
[-- Type: text/x-patch, Size: 883 bytes --]

--- arch/powerpc/platforms/powermac/low_i2c.c.sav	2010-02-06 11:52:21.000000000 +0000
+++ arch/powerpc/platforms/powermac/low_i2c.c	2010-02-06 11:53:07.000000000 +0000
@@ -591,7 +591,7 @@ static void __init kw_i2c_probe(void)
 	/* Probe keywest-i2c busses */
 	for_each_compatible_node(np, "i2c","keywest-i2c") {
 		struct pmac_i2c_host_kw *host;
-		int multibus, chans, i;
+		int multibus;
 
 		/* Found one, init a host structure */
 		host = kw_i2c_host_init(np);
@@ -613,6 +613,8 @@ static void __init kw_i2c_probe(void)
 		 * parent type
 		 */
 		if (multibus) {
+			int chans, i;
+
 			parent = of_get_parent(np);
 			if (parent == NULL)
 				continue;
@@ -1257,8 +1259,7 @@ static void pmac_i2c_do_end(struct pmf_f
 	if (inst == NULL)
 		return;
 	pmac_i2c_close(inst->bus);
-	if (inst)
-		kfree(inst);
+	kfree(inst);
 }
 
 static int pmac_i2c_do_read(PMF_STD_ARGS, u32 len)

             reply	other threads:[~2010-02-06 12:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-06 12:13 d binderman [this message]
2010-04-07  4:23 ` powermac/low_i2c.c: three minor problems Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BLU108-W1270106CF117770B0ABB269C530@phx.gbl \
    --to=dcb314@hotmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).