From: Anton Vorontsov Date: Mon, 4 Feb 2008 13:46:17 +0000 (+0300) Subject: [POWERPC] qe_lib: fix few fluffy negligences X-Git-Tag: v2.6.25-rc1~303^2~25^2~1 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8985fd2b8ef8994399ea33f7e5b24395f5a7cab;p=linux-2.6 [POWERPC] qe_lib: fix few fluffy negligences One is intoduced by me (of_node_put() absence) and another was present already (not checking for NULL). Found by Stephen Rothwell. Signed-off-by: Anton Vorontsov Acked-by: Stephen Rothwell Signed-off-by: Kumar Gala --- diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 5ef844da93..6efbd5e5bb 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c @@ -66,7 +66,7 @@ phys_addr_t get_qe_base(void) { struct device_node *qe; unsigned int size; - const void *prop; + const u32 *prop; if (qebase != -1) return qebase; @@ -79,7 +79,8 @@ phys_addr_t get_qe_base(void) } prop = of_get_property(qe, "reg", &size); - qebase = of_translate_address(qe, prop); + if (prop && size >= sizeof(*prop)) + qebase = of_translate_address(qe, prop); of_node_put(qe); return qebase; @@ -172,10 +173,9 @@ unsigned int get_brg_clk(void) } prop = of_get_property(qe, "brg-frequency", &size); - if (!prop || size != sizeof(*prop)) - return brg_clk; + if (prop && size == sizeof(*prop)) + brg_clk = *prop; - brg_clk = *prop; of_node_put(qe); return brg_clk;