smem.c (8377f8181da8dce24ace68a43e280f6a6cb2c51c) | smem.c (8fa1a21409da6abfe890f66532f9fcd8d2c25a3d) |
---|---|
1/* 2 * Copyright (c) 2015, Sony Mobile Communications AB. 3 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 and 7 * only version 2 as published by the Free Software Foundation. 8 * --- 684 unchanged lines hidden (view full) --- 693 return SMEM_ITEM_COUNT; 694 695 return le16_to_cpu(info->num_items); 696} 697 698static int qcom_smem_set_global_partition(struct qcom_smem *smem) 699{ 700 struct smem_partition_header *header; | 1/* 2 * Copyright (c) 2015, Sony Mobile Communications AB. 3 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 and 7 * only version 2 as published by the Free Software Foundation. 8 * --- 684 unchanged lines hidden (view full) --- 693 return SMEM_ITEM_COUNT; 694 695 return le16_to_cpu(info->num_items); 696} 697 698static int qcom_smem_set_global_partition(struct qcom_smem *smem) 699{ 700 struct smem_partition_header *header; |
701 struct smem_ptable_entry *entry = NULL; | 701 struct smem_ptable_entry *entry; |
702 struct smem_ptable *ptable; 703 u32 host0, host1, size; | 702 struct smem_ptable *ptable; 703 u32 host0, host1, size; |
704 bool found = false; |
|
704 int i; 705 706 ptable = qcom_smem_get_ptable(smem); 707 if (IS_ERR(ptable)) 708 return PTR_ERR(ptable); 709 710 for (i = 0; i < le32_to_cpu(ptable->num_entries); i++) { 711 entry = &ptable->entry[i]; 712 host0 = le16_to_cpu(entry->host0); 713 host1 = le16_to_cpu(entry->host1); 714 | 705 int i; 706 707 ptable = qcom_smem_get_ptable(smem); 708 if (IS_ERR(ptable)) 709 return PTR_ERR(ptable); 710 711 for (i = 0; i < le32_to_cpu(ptable->num_entries); i++) { 712 entry = &ptable->entry[i]; 713 host0 = le16_to_cpu(entry->host0); 714 host1 = le16_to_cpu(entry->host1); 715 |
715 if (host0 == SMEM_GLOBAL_HOST && host0 == host1) | 716 if (host0 == SMEM_GLOBAL_HOST && host0 == host1) { 717 found = true; |
716 break; | 718 break; |
719 } |
|
717 } 718 | 720 } 721 |
719 if (!entry) { | 722 if (!found) { |
720 dev_err(smem->dev, "Missing entry for global partition\n"); 721 return -EINVAL; 722 } 723 724 if (!le32_to_cpu(entry->offset) || !le32_to_cpu(entry->size)) { 725 dev_err(smem->dev, "Invalid entry for global partition\n"); 726 return -EINVAL; 727 } --- 266 unchanged lines hidden --- | 723 dev_err(smem->dev, "Missing entry for global partition\n"); 724 return -EINVAL; 725 } 726 727 if (!le32_to_cpu(entry->offset) || !le32_to_cpu(entry->size)) { 728 dev_err(smem->dev, "Invalid entry for global partition\n"); 729 return -EINVAL; 730 } --- 266 unchanged lines hidden --- |