[PATCH 1/4] staging: ccree: Remove a attribute group from a kobject

2017-11-24 Thread Arvind Yadav
All attribute group created during sys_init_dir() should be removed
in sys_free_dir()

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/staging/ccree/ssi_sysfs.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_sysfs.c 
b/drivers/staging/ccree/ssi_sysfs.c
index 5d39f15..14a3f32 100644
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -145,8 +145,11 @@ static void sys_free_dir(struct sys_dir *sys_dir)
 
kfree(sys_dir->sys_dir_attr_list);
 
-   if (sys_dir->sys_dir_kobj)
+   if (sys_dir->sys_dir_kobj) {
+   sysfs_remove_group(sys_dir->sys_dir_kobj,
+  _dir->sys_dir_attr_group);
kobject_put(sys_dir->sys_dir_kobj);
+   }
 }
 
 int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata)
-- 
2.7.4



[PATCH 3/4] staging: lustre: obdclass: Remove a attribute group from a kobject

2017-11-24 Thread Arvind Yadav
All attribute group created during class_procfs_init() should be
removed.
if class_procfs_init() will fail and also in class_procfs_clean().

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index fc59f29..5795123 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -501,6 +501,7 @@ int class_procfs_init(void)
rc = debugfs_lustre_root ? PTR_ERR(debugfs_lustre_root)
 : -ENOMEM;
debugfs_lustre_root = NULL;
+   sysfs_remove_group(lustre_kobj, _attr_group);
kobject_put(lustre_kobj);
goto out;
}
@@ -509,6 +510,7 @@ int class_procfs_init(void)
   _device_list_fops);
if (IS_ERR_OR_NULL(file)) {
rc = file ? PTR_ERR(file) : -ENOMEM;
+   sysfs_remove_group(lustre_kobj, _attr_group);
kobject_put(lustre_kobj);
goto out;
}
@@ -522,6 +524,7 @@ int class_procfs_clean(void)
 
debugfs_lustre_root = NULL;
 
+   sysfs_remove_group(lustre_kobj, _attr_group);
kobject_put(lustre_kobj);
 
return 0;
-- 
2.7.4



[PATCH 4/4] staging: most: Remove a attribute group from a kobject

2017-11-24 Thread Arvind Yadav
All attribute group created during dim2_sysfs_probe() should be removed
in dim2_sysfs_destroy().

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/staging/most/hdm-dim2/dim2_sysfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/most/hdm-dim2/dim2_sysfs.c 
b/drivers/staging/most/hdm-dim2/dim2_sysfs.c
index d8b22f9..c038ff5 100644
--- a/drivers/staging/most/hdm-dim2/dim2_sysfs.c
+++ b/drivers/staging/most/hdm-dim2/dim2_sysfs.c
@@ -111,5 +111,6 @@ int dim2_sysfs_probe(struct medialb_bus *bus, struct 
kobject *parent_kobj)
 
 void dim2_sysfs_destroy(struct medialb_bus *bus)
 {
+   sysfs_remove_group(>kobj_group, _attr_group);
kobject_put(>kobj_group);
 }
-- 
2.7.4



[PATCH 2/4] staging: lustre: ldlm: Remove a attribute group from a kobject

2017-11-24 Thread Arvind Yadav
All attribute group created during ldlm_setup() should be removed
in ldlm_cleanup().

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index 2d5a2c9..ada50b6 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -1093,8 +1093,10 @@ static int ldlm_cleanup(void)
kset_unregister(ldlm_ns_kset);
if (ldlm_svc_kset)
kset_unregister(ldlm_svc_kset);
-   if (ldlm_kobj)
+   if (ldlm_kobj) {
+   sysfs_remove_group(ldlm_kobj, _attr_group);
kobject_put(ldlm_kobj);
+   }
 
ldlm_debugfs_cleanup();
 
-- 
2.7.4



[PATCH 0/4] Remove a attribute group from a kobject

2017-11-24 Thread Arvind Yadav
Arvind Yadav (4):
  [PATCH 1/4] staging: ccree: Remove a attribute group from a kobject
  [PATCH 2/4] staging: lustre: ldlm: Remove a attribute group from a kobject
  [PATCH 3/4] staging: lustre: obdclass: Remove a attribute group from a kobject
  [PATCH 4/4] staging: most: Remove a attribute group from a kobject

 drivers/staging/ccree/ssi_sysfs.c   | 5 -
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 4 +++-
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 3 +++
 drivers/staging/most/hdm-dim2/dim2_sysfs.c  | 1 +
 4 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.7.4



[PATCH 1/5] crypto: omap-aes: pr_err() strings should end with newlines

2017-09-25 Thread Arvind Yadav
pr_err() messages should terminated with a new-line to avoid
other messages being concatenated onto the end.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/omap-aes-gcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/omap-aes-gcm.c b/drivers/crypto/omap-aes-gcm.c
index 7d4f8a4..9f8a1f7 100644
--- a/drivers/crypto/omap-aes-gcm.c
+++ b/drivers/crypto/omap-aes-gcm.c
@@ -214,7 +214,7 @@ static int do_encrypt_iv(struct aead_request *req, u32 
*tag, u32 *iv)
}
/* fall through */
default:
-   pr_err("Encryption of IV failed for GCM mode");
+   pr_err("Encryption of IV failed for GCM mode\n");
break;
}
 
-- 
1.9.1



[PATCH 2/5] crypto: virtio: pr_err() strings should end with newlines

2017-09-25 Thread Arvind Yadav
pr_err() messages should terminated with a new-line to avoid
other messages being concatenated onto the end.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/virtio/virtio_crypto_algs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c 
b/drivers/crypto/virtio/virtio_crypto_algs.c
index 5035b0d..abe8c15 100644
--- a/drivers/crypto/virtio/virtio_crypto_algs.c
+++ b/drivers/crypto/virtio/virtio_crypto_algs.c
@@ -319,7 +319,7 @@ static int virtio_crypto_ablkcipher_setkey(struct 
crypto_ablkcipher *tfm,
struct virtio_crypto *vcrypto =
  virtcrypto_get_dev_node(node);
if (!vcrypto) {
-   pr_err("virtio_crypto: Could not find a virtio device 
in the system");
+   pr_err("virtio_crypto: Could not find a virtio device 
in the system\n");
return -ENODEV;
}
 
-- 
1.9.1



[PATCH 5/5] crypto: bcm: pr_err() strings should end with newlines

2017-09-25 Thread Arvind Yadav
pr_err() messages should terminated with a new-line to avoid
other messages being concatenated onto the end.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/bcm/util.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/bcm/util.c b/drivers/crypto/bcm/util.c
index 430c557..d543c01 100644
--- a/drivers/crypto/bcm/util.c
+++ b/drivers/crypto/bcm/util.c
@@ -271,7 +271,7 @@ int do_shash(unsigned char *name, unsigned char *result,
hash = crypto_alloc_shash(name, 0, 0);
if (IS_ERR(hash)) {
rc = PTR_ERR(hash);
-   pr_err("%s: Crypto %s allocation error %d", __func__, name, rc);
+   pr_err("%s: Crypto %s allocation error %d\n", __func__, name, 
rc);
return rc;
}
 
@@ -279,7 +279,7 @@ int do_shash(unsigned char *name, unsigned char *result,
sdesc = kmalloc(size, GFP_KERNEL);
if (!sdesc) {
rc = -ENOMEM;
-   pr_err("%s: Memory allocation failure", __func__);
+   pr_err("%s: Memory allocation failure\n", __func__);
goto do_shash_err;
}
sdesc->shash.tfm = hash;
@@ -288,31 +288,31 @@ int do_shash(unsigned char *name, unsigned char *result,
if (key_len > 0) {
rc = crypto_shash_setkey(hash, key, key_len);
if (rc) {
-   pr_err("%s: Could not setkey %s shash", __func__, name);
+   pr_err("%s: Could not setkey %s shash\n", __func__, 
name);
goto do_shash_err;
}
}
 
rc = crypto_shash_init(>shash);
if (rc) {
-   pr_err("%s: Could not init %s shash", __func__, name);
+   pr_err("%s: Could not init %s shash\n", __func__, name);
goto do_shash_err;
}
rc = crypto_shash_update(>shash, data1, data1_len);
if (rc) {
-   pr_err("%s: Could not update1", __func__);
+   pr_err("%s: Could not update1\n", __func__);
goto do_shash_err;
}
if (data2 && data2_len) {
rc = crypto_shash_update(>shash, data2, data2_len);
if (rc) {
-   pr_err("%s: Could not update2", __func__);
+   pr_err("%s: Could not update2\n", __func__);
goto do_shash_err;
}
}
rc = crypto_shash_final(>shash, result);
if (rc)
-   pr_err("%s: Could not generate %s hash", __func__, name);
+   pr_err("%s: Could not generate %s hash\n", __func__, name);
 
 do_shash_err:
crypto_free_shash(hash);
-- 
1.9.1



[PATCH 3/5] crypto: chelsio: pr_err() strings should end with newlines

2017-09-25 Thread Arvind Yadav
pr_err() messages should terminated with a new-line to avoid
other messages being concatenated onto the end.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/chelsio/chcr_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_core.c 
b/drivers/crypto/chelsio/chcr_core.c
index b6dd9cb..32618bf 100644
--- a/drivers/crypto/chelsio/chcr_core.c
+++ b/drivers/crypto/chelsio/chcr_core.c
@@ -224,7 +224,7 @@ static int chcr_uld_state_change(void *handle, enum 
cxgb4_state state)
 static int __init chcr_crypto_init(void)
 {
if (cxgb4_register_uld(CXGB4_ULD_CRYPTO, _uld_info))
-   pr_err("ULD register fail: No chcr crypto support in cxgb4");
+   pr_err("ULD register fail: No chcr crypto support in cxgb4\n");
 
return 0;
 }
-- 
1.9.1



[PATCH 0/5] crypto pr_err() strings should end with newlines

2017-09-25 Thread Arvind Yadav
pr_err() messages should terminated with a new-line to avoid
other messages being concatenated onto the end.

Arvind Yadav (5):
  [PATCH 1/5] crypto: omap-aes: pr_err() strings should end with newlines
  [PATCH 2/5] crypto: virtio: pr_err() strings should end with newlines
  [PATCH 3/5] crypto: chelsio: pr_err() strings should end with newlines
  [PATCH 4/5] crypto: qat: pr_err() strings should end with newlines
  [PATCH 5/5] crypto: bcm: pr_err() strings should end with newlines

 drivers/crypto/bcm/util.c  | 14 +++---
 drivers/crypto/chelsio/chcr_core.c |  2 +-
 drivers/crypto/omap-aes-gcm.c  |  2 +-
 drivers/crypto/qat/qat_common/qat_uclo.c   | 12 ++--
 drivers/crypto/virtio/virtio_crypto_algs.c |  2 +-
 5 files changed, 16 insertions(+), 16 deletions(-)

-- 
1.9.1



[PATCH] hwrng: pr_err() strings should end with newlines

2017-09-25 Thread Arvind Yadav
pr_err() messages should terminated with a new-line to avoid
other messages being concatenated onto the end.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/char/hw_random/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 9701ac7..ff79844 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -423,7 +423,7 @@ static void start_khwrngd(void)
 {
hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng");
if (IS_ERR(hwrng_fill)) {
-   pr_err("hwrng_fill thread creation failed");
+   pr_err("hwrng_fill thread creation failed\n");
hwrng_fill = NULL;
}
 }
-- 
1.9.1



[PATCH] crypto: padlock-sha: constify x86_cpu_id

2017-08-25 Thread Arvind Yadav
x86_cpu_id are not supposed to change at runtime. MODULE_DEVICE_TABLE
and x86_match_cpu are working with const x86_cpu_id. So mark the
non-const x86_cpu_id structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/padlock-sha.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
index bc72d20..d32c793 100644
--- a/drivers/crypto/padlock-sha.c
+++ b/drivers/crypto/padlock-sha.c
@@ -509,7 +509,7 @@ static struct shash_alg sha256_alg_nano = {
}
 };
 
-static struct x86_cpu_id padlock_sha_ids[] = {
+static const struct x86_cpu_id padlock_sha_ids[] = {
X86_FEATURE_MATCH(X86_FEATURE_PHE),
{}
 };
-- 
2.7.4



[PATCH] crypto: padlock-aes: constify x86_cpu_id

2017-08-25 Thread Arvind Yadav
x86_cpu_id are not supposed to change at runtime. MODULE_DEVICE_TABLE
and x86_match_cpu are working with const x86_cpu_id. So mark the
non-const x86_cpu_id structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/padlock-aes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index b386974..4b6642a 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -482,7 +482,7 @@ static struct crypto_alg cbc_aes_alg = {
}
 };
 
-static struct x86_cpu_id padlock_cpu_id[] = {
+static const struct x86_cpu_id padlock_cpu_id[] = {
X86_FEATURE_MATCH(X86_FEATURE_XCRYPT),
{}
 };
-- 
2.7.4



[PATCH] hwrng: pseries: constify vio_device_id

2017-08-17 Thread Arvind Yadav
vio_device_id are not supposed to change at runtime. All functions
working with vio_device_id provided by  work with
const vio_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/char/hw_random/pseries-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/pseries-rng.c 
b/drivers/char/hw_random/pseries-rng.c
index d9f46b4..4e2a3f6 100644
--- a/drivers/char/hw_random/pseries-rng.c
+++ b/drivers/char/hw_random/pseries-rng.c
@@ -72,7 +72,7 @@ static int pseries_rng_remove(struct vio_dev *dev)
return 0;
 }
 
-static struct vio_device_id pseries_rng_driver_ids[] = {
+static const struct vio_device_id pseries_rng_driver_ids[] = {
{ "ibm,random-v1", "ibm,random"},
{ "", "" }
 };
-- 
2.7.4



[PATCH] crypto: nx: 842: constify vio_device_id

2017-08-17 Thread Arvind Yadav
vio_device_id are not supposed to change at runtime. All functions
working with vio_device_id provided by  work with
const vio_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/nx/nx-842-pseries.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/nx/nx-842-pseries.c 
b/drivers/crypto/nx/nx-842-pseries.c
index cddc6d8..bf52cd1 100644
--- a/drivers/crypto/nx/nx-842-pseries.c
+++ b/drivers/crypto/nx/nx-842-pseries.c
@@ -1082,7 +1082,7 @@ static int nx842_remove(struct vio_dev *viodev)
return 0;
 }
 
-static struct vio_device_id nx842_vio_driver_ids[] = {
+static const struct vio_device_id nx842_vio_driver_ids[] = {
{"ibm,compression-v1", "ibm,compression"},
{"", ""},
 };
-- 
2.7.4



[PATCH] crypto: nx: constify vio_device_id

2017-08-17 Thread Arvind Yadav
vio_device_id are not supposed to change at runtime. All functions
working with vio_device_id provided by  work with
const vio_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/nx/nx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
index 036057a..3a5e31b 100644
--- a/drivers/crypto/nx/nx.c
+++ b/drivers/crypto/nx/nx.c
@@ -833,7 +833,7 @@ static void __exit nx_fini(void)
vio_unregister_driver(_driver.viodriver);
 }
 
-static struct vio_device_id nx_crypto_driver_ids[] = {
+static const struct vio_device_id nx_crypto_driver_ids[] = {
{ "ibm,sym-encryption-v1", "ibm,sym-encryption" },
{ "", "" }
 };
-- 
2.7.4



[PATCH] crypto: sahara: constify platform_device_id

2017-08-13 Thread Arvind Yadav
platform_device_id are not supposed to change at runtime. All functions
working with platform_device_id provided by 
work with const platform_device_id. So mark the non-const structs as
const.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/sahara.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 1d9ecd3..39efa65 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -1376,7 +1376,7 @@ static void sahara_unregister_algs(struct sahara_dev *dev)
crypto_unregister_ahash(_v4_algs[i]);
 }
 
-static struct platform_device_id sahara_platform_ids[] = {
+static const struct platform_device_id sahara_platform_ids[] = {
{ .name = "sahara-imx27" },
{ /* sentinel */ }
 };
-- 
2.7.4



[PATCH] staging: ccree: constify dev_pm_ops structures.

2017-08-08 Thread Arvind Yadav
dev_pm_ops are not supposed to change at runtime. All functions
working with dev_pm_ops provided by  work with const
dev_pm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/staging/ccree/ssi_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index e0faca0..1753906 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -549,7 +549,7 @@ static int cc7x_remove(struct platform_device *plat_dev)
 }
 
 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
-static struct dev_pm_ops arm_cc7x_driver_pm = {
+static const struct dev_pm_ops arm_cc7x_driver_pm = {
SET_RUNTIME_PM_OPS(ssi_power_mgr_runtime_suspend, 
ssi_power_mgr_runtime_resume, NULL)
 };
 #endif
-- 
1.9.1



[PATCH] crypto: sahara : make of_device_ids const.

2017-06-27 Thread Arvind Yadav
of_device_ids are not supposed to change at runtime. All functions
working with of_device_ids provided by  work with const
of_device_ids. So mark the non-const structs as const.

File size before:
   textdata bss dec hex filename
   97592736   8   1250330d7 drivers/crypto/sahara.o

File size after constify:
   textdata bss dec hex filename
  103672128   8   1250330d7 drivers/crypto/sahara.o

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/sahara.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 1d9ecd3..c2174ec 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -1382,7 +1382,7 @@ static void sahara_unregister_algs(struct sahara_dev *dev)
 };
 MODULE_DEVICE_TABLE(platform, sahara_platform_ids);
 
-static struct of_device_id sahara_dt_ids[] = {
+static const struct of_device_id sahara_dt_ids[] = {
{ .compatible = "fsl,imx53-sahara" },
{ .compatible = "fsl,imx27-sahara" },
{ /* sentinel */ }
-- 
1.9.1



[PATCH] crypto: caam: make of_device_ids const.

2017-06-16 Thread Arvind Yadav
of_device_ids are not supposed to change at runtime. All functions
working with of_device_ids provided by  work with const
of_device_ids. So mark the non-const structs as const.

File size before:
   textdata bss dec hex filename
   2376 808 1283312 cf0 drivers/crypto/caam/jr.o

File size after constify caam_jr_match:
   textdata bss dec hex filename
   2976 192 1283296 ce0 drivers/crypto/caam/jr.o

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/caam/jr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 2763100..1ccfb31 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -536,7 +536,7 @@ static int caam_jr_probe(struct platform_device *pdev)
return 0;
 }
 
-static struct of_device_id caam_jr_match[] = {
+static const struct of_device_id caam_jr_match[] = {
{
.compatible = "fsl,sec-v4.0-job-ring",
},
-- 
1.9.1



[PATCH] crypto: n2: make of_device_ids const

2017-06-15 Thread Arvind Yadav
of_device_ids are not supposed to change at runtime. All functions
working with of_device_ids provided by  work with const
of_device_ids. So mark the non-const structs as const.

File size before:
   textdata bss dec hex filename
   20012168  4842171079 drivers/crypto/n2_core.o

File size after constify dummy_tlb_ops.:
   textdata bss dec hex filename
   3601 536  4841851059 drivers/crypto/n2_core.o

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/n2_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 4ecb77a..2694513 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -2169,7 +2169,7 @@ static int n2_mau_remove(struct platform_device *dev)
return 0;
 }
 
-static struct of_device_id n2_crypto_match[] = {
+static const struct of_device_id n2_crypto_match[] = {
{
.name = "n2cp",
.compatible = "SUNW,n2-cwq",
@@ -2196,7 +2196,7 @@ static int n2_mau_remove(struct platform_device *dev)
.remove =   n2_crypto_remove,
 };
 
-static struct of_device_id n2_mau_match[] = {
+static const struct of_device_id n2_mau_match[] = {
{
.name = "ncp",
.compatible = "SUNW,n2-mau",
-- 
1.9.1



[PATCH v1] crypto: img-hash - Handle return value of clk_prepare_enable

2017-05-16 Thread Arvind Yadav
Here, Clock enable can failed. So adding an error check for
clk_prepare_enable.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/img-hash.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index 9b07f3d8..0c6a917 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -1088,9 +1088,17 @@ static int img_hash_suspend(struct device *dev)
 static int img_hash_resume(struct device *dev)
 {
struct img_hash_dev *hdev = dev_get_drvdata(dev);
+   int ret;
 
-   clk_prepare_enable(hdev->hash_clk);
-   clk_prepare_enable(hdev->sys_clk);
+   ret = clk_prepare_enable(hdev->hash_clk);
+   if (ret)
+   return ret;
+
+   ret = clk_prepare_enable(hdev->sys_clk);
+   if (ret) {
+   clk_disable_unprepare(hdev->hash_clk);
+   return ret;
+   }
 
return 0;
 }
-- 
1.9.1



[PATCH v1] hw_random : omap3-rom-rng:- Handle return value of clk_prepare_enable

2017-05-15 Thread Arvind Yadav
Here, Clock enable can failed. So adding an error check for
clk_prepare_enable.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/char/hw_random/omap3-rom-rng.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/omap3-rom-rng.c 
b/drivers/char/hw_random/omap3-rom-rng.c
index 37a58d7..38b7190 100644
--- a/drivers/char/hw_random/omap3-rom-rng.c
+++ b/drivers/char/hw_random/omap3-rom-rng.c
@@ -53,7 +53,10 @@ static int omap3_rom_rng_get_random(void *buf, unsigned int 
count)
 
cancel_delayed_work_sync(_work);
if (rng_idle) {
-   clk_prepare_enable(rng_clk);
+   r = clk_prepare_enable(rng_clk);
+   if (r)
+   return r;
+
r = omap3_rom_rng_call(0, 0, RNG_GEN_PRNG_HW_INIT);
if (r != 0) {
clk_disable_unprepare(rng_clk);
@@ -88,6 +91,8 @@ static int omap3_rom_rng_read(struct hwrng *rng, void *data, 
size_t max, bool w)
 
 static int omap3_rom_rng_probe(struct platform_device *pdev)
 {
+   int ret = 0;
+
pr_info("initializing\n");
 
omap3_rom_rng_call = pdev->dev.platform_data;
@@ -104,7 +109,9 @@ static int omap3_rom_rng_probe(struct platform_device *pdev)
}
 
/* Leave the RNG in reset state. */
-   clk_prepare_enable(rng_clk);
+   ret = clk_prepare_enable(rng_clk);
+   if (ret)
+   return ret;
omap3_rom_rng_idle(0);
 
return hwrng_register(_rom_rng_ops);
-- 
1.9.1



[PATCH] crypto/caam/jr : Unmap region obtained by of_iomap

2016-09-28 Thread Arvind Yadav
From: Arvind Yadav <arvind.yadav...@gmail.com>

Free memory mapping, if probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/crypto/caam/jr.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index a81f551..9e7f281 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -513,6 +513,7 @@ static int caam_jr_probe(struct platform_device *pdev)
error = caam_jr_init(jrdev); /* now turn on hardware */
if (error) {
irq_dispose_mapping(jrpriv->irq);
+   iounmap(ctrl);
return error;
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] char: hw_random: bcm2835: handle of_iomap failures in bcm2835 driver

2016-08-30 Thread Arvind Yadav
Check return value of of_iomap and handle errors correctly.

Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
---
 drivers/char/hw_random/bcm2835-rng.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/bcm2835-rng.c 
b/drivers/char/hw_random/bcm2835-rng.c
index af21492..574211a 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -92,9 +92,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
bcm2835_rng_ops.priv = (unsigned long)rng_base;
 
rng_id = of_match_node(bcm2835_rng_of_match, np);
-   if (!rng_id)
+   if (!rng_id) {
+   iounmap(rng_base);
return -EINVAL;
-
+   }
/* Check for rng init function, execute it */
rng_setup = rng_id->data;
if (rng_setup)
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html