Commit d62112f2 authored by saurabh's avatar saurabh Committed by Herbert Xu

crypto: nx - use of_property_read_u32()

use of_propert_read_u32() for reading int value,
it can help reducing number of variables used
Signed-off-by: default avatarSaurabh Sengar <saurabh.truth@gmail.com>
Acked-by: default avatarDan Streetman <ddstreet@ieee.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 1d4bbc5a
...@@ -525,7 +525,6 @@ static int nx842_powernv_decompress(const unsigned char *in, unsigned int inlen, ...@@ -525,7 +525,6 @@ static int nx842_powernv_decompress(const unsigned char *in, unsigned int inlen,
static int __init nx842_powernv_probe(struct device_node *dn) static int __init nx842_powernv_probe(struct device_node *dn)
{ {
struct nx842_coproc *coproc; struct nx842_coproc *coproc;
struct property *ct_prop, *ci_prop;
unsigned int ct, ci; unsigned int ct, ci;
int chip_id; int chip_id;
...@@ -534,18 +533,16 @@ static int __init nx842_powernv_probe(struct device_node *dn) ...@@ -534,18 +533,16 @@ static int __init nx842_powernv_probe(struct device_node *dn)
pr_err("ibm,chip-id missing\n"); pr_err("ibm,chip-id missing\n");
return -EINVAL; return -EINVAL;
} }
ct_prop = of_find_property(dn, "ibm,842-coprocessor-type", NULL);
if (!ct_prop) { if (of_property_read_u32(dn, "ibm,842-coprocessor-type", &ct)) {
pr_err("ibm,842-coprocessor-type missing\n"); pr_err("ibm,842-coprocessor-type missing\n");
return -EINVAL; return -EINVAL;
} }
ct = be32_to_cpu(*(unsigned int *)ct_prop->value);
ci_prop = of_find_property(dn, "ibm,842-coprocessor-instance", NULL); if (of_property_read_u32(dn, "ibm,842-coprocessor-instance", &ci)) {
if (!ci_prop) {
pr_err("ibm,842-coprocessor-instance missing\n"); pr_err("ibm,842-coprocessor-instance missing\n");
return -EINVAL; return -EINVAL;
} }
ci = be32_to_cpu(*(unsigned int *)ci_prop->value);
coproc = kmalloc(sizeof(*coproc), GFP_KERNEL); coproc = kmalloc(sizeof(*coproc), GFP_KERNEL);
if (!coproc) if (!coproc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment