Skip to content

Commit

Permalink
crypto: nx - use of_property_read_u32()
Browse files Browse the repository at this point in the history
use of_propert_read_u32() for reading int value,
it can help reducing number of variables used

Signed-off-by: Saurabh Sengar <[email protected]>
Acked-by: Dan Streetman <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
saurabh-sengar authored and herbertx committed Nov 24, 2015
1 parent 1d4bbc5 commit d62112f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/crypto/nx/nx-842-powernv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct nx842_coproc *coproc;
struct property *ct_prop, *ci_prop;
unsigned int ct, ci;
int chip_id;

Expand All @@ -534,18 +533,16 @@ static int __init nx842_powernv_probe(struct device_node *dn)
pr_err("ibm,chip-id missing\n");
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");
return -EINVAL;
}
ct = be32_to_cpu(*(unsigned int *)ct_prop->value);
ci_prop = of_find_property(dn, "ibm,842-coprocessor-instance", NULL);
if (!ci_prop) {

if (of_property_read_u32(dn, "ibm,842-coprocessor-instance", &ci)) {
pr_err("ibm,842-coprocessor-instance missing\n");
return -EINVAL;
}
ci = be32_to_cpu(*(unsigned int *)ci_prop->value);

coproc = kmalloc(sizeof(*coproc), GFP_KERNEL);
if (!coproc)
Expand Down

0 comments on commit d62112f

Please sign in to comment.