Christophe JAILLET
2016-Sep-23 21:06 UTC
[Nouveau] [PATCH] drm/nouveau/secboot/gm20b: Fix return value in case of error
If 'ioremap()' returns 0, 'gm20b_tegra_read_wpr()' will return 0 as well, which means success. Return -ENOMEM instead Signed-off-by: Christophe JAILLET <christophe.jaillet at wanadoo.fr> --- Not sure that -ENOMEM is the best value. I've taken it because it is often used in such a case. --- drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c index d5395ebfe8d3..d88db933b3fd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c @@ -142,7 +142,7 @@ gm20b_tegra_read_wpr(struct gm200_secboot *gsb) mc = ioremap(TEGRA_MC_BASE, 0xd00); if (!mc) { nvkm_error(&sb->subdev, "Cannot map Tegra MC registers\n"); - return PTR_ERR(mc); + return -ENOMEM; } gsb->wpr_addr = ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_0) | ((u64)ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_HI_0) << 32); -- 2.7.4
Alexandre Courbot
2016-Sep-25 09:36 UTC
[Nouveau] [PATCH] drm/nouveau/secboot/gm20b: Fix return value in case of error
On Sat, Sep 24, 2016 at 6:06 AM, Christophe JAILLET <christophe.jaillet at wanadoo.fr> wrote:> If 'ioremap()' returns 0, 'gm20b_tegra_read_wpr()' will return 0 as well, > which means success. > Return -ENOMEM insteadReviewed-by: Alexandre Courbot <acourbot at nvidia.com>> > Signed-off-by: Christophe JAILLET <christophe.jaillet at wanadoo.fr> > --- > Not sure that -ENOMEM is the best value. > I've taken it because it is often used in such a case. > --- > drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c > index d5395ebfe8d3..d88db933b3fd 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c > @@ -142,7 +142,7 @@ gm20b_tegra_read_wpr(struct gm200_secboot *gsb) > mc = ioremap(TEGRA_MC_BASE, 0xd00); > if (!mc) { > nvkm_error(&sb->subdev, "Cannot map Tegra MC registers\n"); > - return PTR_ERR(mc); > + return -ENOMEM; > } > gsb->wpr_addr = ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_0) | > ((u64)ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_HI_0) << 32); > -- > 2.7.4 > > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau
Seemingly Similar Threads
- Error handling in drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
- [PATCH 03/11] drm/nouveau: secboot: Read WPR configuration from GPU registers
- [PATCH -next] drm/nouveau/secboot/gm20b: fix the error return code in gm20b_secboot_tegra_read_wpr()
- [PATCH 0/4] secboot: be more resilient on errors
- [PATCH] nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new()