[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-5.1 v2 08/54] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus'
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-5.1 v2 08/54] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count |
Date: |
Mon, 6 Apr 2020 19:46:57 +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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH-for-5.1 v2 08/54] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count,
Philippe Mathieu-Daudé <=