[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-5.1 v3 08/24] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus'
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-5.1 v3 08/24] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count |
Date: |
Mon, 13 Apr 2020 00:36:03 +0200 |
Coccinelle failed at processing this file:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/fsl-imx6.c
Fatal error: exception Coccinelle_modules.Common.Timeout
While reviewing we notice the smp_cpus count is already limited
by MachineClass::max_cpus:
static void sabrelite_machine_init(MachineClass *mc)
{
mc->max_cpus = FSL_IMX6_NUM_CPUS;
...
}
So remove the check in realize(), but still assert in init().
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/arm/fsl-imx6.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
index 13f1bf23a6..3d37352b08 100644
--- a/hw/arm/fsl-imx6.c
+++ b/hw/arm/fsl-imx6.c
@@ -37,10 +37,12 @@
static void fsl_imx6_init(Object *obj)
{
MachineState *ms = MACHINE(qdev_get_machine());
+ unsigned int smp_cpus = ms->smp.cpus;
FslIMX6State *s = FSL_IMX6(obj);
char name[NAME_SIZE];
int i;
+ assert(smp_cpus <= FSL_IMX6_NUM_CPUS);
for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX6_NUM_CPUS); i++) {
snprintf(name, NAME_SIZE, "cpu%d", i);
object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]),
@@ -121,12 +123,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error
**errp)
Error *err = NULL;
unsigned int smp_cpus = ms->smp.cpus;
- if (smp_cpus > FSL_IMX6_NUM_CPUS) {
- error_setg(errp, "%s: Only %d CPUs are supported (%d requested)",
- TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus);
- return;
- }
-
for (i = 0; i < smp_cpus; i++) {
/* On uniprocessor, the CBAR is set to 0 */
--
2.21.1
- Re: [PATCH-for-5.1 v3 01/24] various: Remove suspicious '\' character outside of #define in C code, (continued)
- [PATCH-for-5.1 v3 03/24] hw/arm/allwinner-a10: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 04/24] hw/arm/aspeed_ast2600: Simplify use of Error*, Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 05/24] hw/arm/aspeed_ast2600: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 06/24] hw/arm/aspeed_soc: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 07/24] hw/arm/aspeed_soc: Simplify use of Error*, Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 08/24] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count,
Philippe Mathieu-Daudé <=
- [PATCH-for-5.1 v3 09/24] hw/arm/fsl-imx6: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 10/24] hw/arm/fsl-imx31: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 11/24] hw/arm/msf2-soc: Store MemoryRegion in MSF2State, Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 12/24] hw/arm/stm32f205_soc: Store MemoryRegion in STM32F205State, Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 13/24] hw/arm/stm32f205_soc: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
- [PATCH-for-5.1 v3 14/24] hw/arm/xlnx-zynqmp: Use single propagate_error() call, Philippe Mathieu-Daudé, 2020/04/12