On Fri, 25 Jun 2021 15:05:44 +0200 Maxime Ripard <max...@cerno.tech> wrote:
> Both mtdparts_init() and find_dev_and_part() will return 0 on success > but 1 on failure. > > Since the calling functions of fb_nand_lookup expects a negative error > code on failure, we can't just return the returned value of these > functions. > > This fixes an issue with the logic that detects whether we support > fastboot slots or not by calling fb_nand_lookup and assuming that > anything >= 0 means the partition is there. > > Signed-off-by: Maxime Ripard <max...@cerno.tech> Yes indeed, good catch! Reviewed-by: Andre Przywara <andre.przyw...@arm.com> Cheers, Andre > --- > drivers/fastboot/fb_nand.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c > index e07df33d3665..9d832fd8ca9a 100644 > --- a/drivers/fastboot/fb_nand.c > +++ b/drivers/fastboot/fb_nand.c > @@ -44,14 +44,14 @@ static int fb_nand_lookup(const char *partname, > if (ret) { > pr_err("Cannot initialize MTD partitions\n"); > fastboot_fail("cannot init mtdparts", response); > - return ret; > + return -EINVAL; > } > > ret = find_dev_and_part(partname, &dev, &pnum, part); > if (ret) { > pr_err("cannot find partition: '%s'\n", partname); > fastboot_fail("cannot find partition", response); > - return ret; > + return -ENODEV; > } > > if (dev->id->type != MTD_DEV_TYPE_NAND) {