* [PATCH v2] android_ab: don't ignore ab_control_store return code
@ 2023-12-25 10:22 Alexey Romanov
2024-01-09 10:37 ` Alexey Romanov
2024-01-12 13:46 ` Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: Alexey Romanov @ 2023-12-25 10:22 UTC (permalink / raw)
To: jpewhacker, sjg, semen.protsenko, igor.opaniuk, mkorpershoek
Cc: u-boot, kernel, Alexey Romanov
ab_control_store() can return an error if writing to disk fails.
In this case, we have to pass the error code to the caller.
Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
boot/android_ab.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/boot/android_ab.c b/boot/android_ab.c
index 73b55c196c..af3c375e07 100644
--- a/boot/android_ab.c
+++ b/boot/android_ab.c
@@ -337,7 +337,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
if (store_needed) {
abc->crc32_le = ab_control_compute_crc(abc);
- ab_control_store(dev_desc, part_info, abc, 0);
+ ret = ab_control_store(dev_desc, part_info, abc, 0);
+ if (ret < 0) {
+#if ANDROID_AB_BACKUP_OFFSET
+ free(backup_abc);
+#endif
+ free(abc);
+ return ret;
+ }
}
#if ANDROID_AB_BACKUP_OFFSET
@@ -346,8 +353,13 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
* to the backup offset
*/
if (memcmp(backup_abc, abc, sizeof(*abc)) != 0) {
- ab_control_store(dev_desc, part_info, abc,
+ ret = ab_control_store(dev_desc, part_info, abc,
ANDROID_AB_BACKUP_OFFSET);
+ if (ret < 0) {
+ free(backup_abc);
+ free(abc);
+ return ret;
+ }
}
free(backup_abc);
#endif
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] android_ab: don't ignore ab_control_store return code
2023-12-25 10:22 [PATCH v2] android_ab: don't ignore ab_control_store return code Alexey Romanov
@ 2024-01-09 10:37 ` Alexey Romanov
2024-01-12 8:56 ` Mattijs Korpershoek
2024-01-12 13:46 ` Tom Rini
1 sibling, 1 reply; 4+ messages in thread
From: Alexey Romanov @ 2024-01-09 10:37 UTC (permalink / raw)
To: jpewhacker@gmail.com, sjg@google.com, semen.protsenko@linaro.org,
igor.opaniuk@gmail.com, mkorpershoek@baylibre.com,
trini@konsulko.com
Cc: u-boot@lists.denx.de, kernel
+ Tom Rini
Hello! Please, ping
On Mon, Dec 25, 2023 at 01:22:45PM +0300, Alexey Romanov wrote:
> ab_control_store() can return an error if writing to disk fails.
> In this case, we have to pass the error code to the caller.
>
> Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> boot/android_ab.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/boot/android_ab.c b/boot/android_ab.c
> index 73b55c196c..af3c375e07 100644
> --- a/boot/android_ab.c
> +++ b/boot/android_ab.c
> @@ -337,7 +337,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
>
> if (store_needed) {
> abc->crc32_le = ab_control_compute_crc(abc);
> - ab_control_store(dev_desc, part_info, abc, 0);
> + ret = ab_control_store(dev_desc, part_info, abc, 0);
> + if (ret < 0) {
> +#if ANDROID_AB_BACKUP_OFFSET
> + free(backup_abc);
> +#endif
> + free(abc);
> + return ret;
> + }
> }
>
> #if ANDROID_AB_BACKUP_OFFSET
> @@ -346,8 +353,13 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
> * to the backup offset
> */
> if (memcmp(backup_abc, abc, sizeof(*abc)) != 0) {
> - ab_control_store(dev_desc, part_info, abc,
> + ret = ab_control_store(dev_desc, part_info, abc,
> ANDROID_AB_BACKUP_OFFSET);
> + if (ret < 0) {
> + free(backup_abc);
> + free(abc);
> + return ret;
> + }
> }
> free(backup_abc);
> #endif
> --
> 2.39.2
>
--
Thank you,
Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] android_ab: don't ignore ab_control_store return code
2024-01-09 10:37 ` Alexey Romanov
@ 2024-01-12 8:56 ` Mattijs Korpershoek
0 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2024-01-12 8:56 UTC (permalink / raw)
To: Alexey Romanov, jpewhacker@gmail.com, sjg@google.com,
semen.protsenko@linaro.org, igor.opaniuk@gmail.com,
trini@konsulko.com
Cc: u-boot@lists.denx.de, kernel
Hi Alexey,
On Tue, Jan 09, 2024 at 10:37, Alexey Romanov <avromanov@salutedevices.com> wrote:
> + Tom Rini
>
> Hello! Please, ping
It seems that Igor (the Android AB maintainer) has been busy elsewhere.
I've requested to take over maintainership:
https://lore.kernel.org/all/20240112-maintainers-ab-v1-0-f2a538eab18a@baylibre.com/
If that gets accepted, I will pick up this patch.
Thank you for your patience,
Mattijs
>
> On Mon, Dec 25, 2023 at 01:22:45PM +0300, Alexey Romanov wrote:
>> ab_control_store() can return an error if writing to disk fails.
>> In this case, we have to pass the error code to the caller.
>>
>> Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
>> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>> ---
>> boot/android_ab.c | 16 ++++++++++++++--
>> 1 file changed, 14 insertions(+), 2 deletions(-)
>>
>> diff --git a/boot/android_ab.c b/boot/android_ab.c
>> index 73b55c196c..af3c375e07 100644
>> --- a/boot/android_ab.c
>> +++ b/boot/android_ab.c
>> @@ -337,7 +337,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
>>
>> if (store_needed) {
>> abc->crc32_le = ab_control_compute_crc(abc);
>> - ab_control_store(dev_desc, part_info, abc, 0);
>> + ret = ab_control_store(dev_desc, part_info, abc, 0);
>> + if (ret < 0) {
>> +#if ANDROID_AB_BACKUP_OFFSET
>> + free(backup_abc);
>> +#endif
>> + free(abc);
>> + return ret;
>> + }
>> }
>>
>> #if ANDROID_AB_BACKUP_OFFSET
>> @@ -346,8 +353,13 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
>> * to the backup offset
>> */
>> if (memcmp(backup_abc, abc, sizeof(*abc)) != 0) {
>> - ab_control_store(dev_desc, part_info, abc,
>> + ret = ab_control_store(dev_desc, part_info, abc,
>> ANDROID_AB_BACKUP_OFFSET);
>> + if (ret < 0) {
>> + free(backup_abc);
>> + free(abc);
>> + return ret;
>> + }
>> }
>> free(backup_abc);
>> #endif
>> --
>> 2.39.2
>>
>
> --
> Thank you,
> Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] android_ab: don't ignore ab_control_store return code
2023-12-25 10:22 [PATCH v2] android_ab: don't ignore ab_control_store return code Alexey Romanov
2024-01-09 10:37 ` Alexey Romanov
@ 2024-01-12 13:46 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2024-01-12 13:46 UTC (permalink / raw)
To: Alexey Romanov
Cc: jpewhacker, sjg, semen.protsenko, igor.opaniuk, mkorpershoek,
u-boot, kernel
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
On Mon, Dec 25, 2023 at 01:22:45PM +0300, Alexey Romanov wrote:
> ab_control_store() can return an error if writing to disk fails.
> In this case, we have to pass the error code to the caller.
>
> Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-12 13:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-25 10:22 [PATCH v2] android_ab: don't ignore ab_control_store return code Alexey Romanov
2024-01-09 10:37 ` Alexey Romanov
2024-01-12 8:56 ` Mattijs Korpershoek
2024-01-12 13:46 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox