drivers/gpib/hp_82335/hp82335.c | 2 ++ 1 file changed, 2 insertions(+)
Stop attach on mapping failure before board reset or register access.
The existing detach path handles the reserved region and private state.
Detected by static analysis and reviewed with AI-assisted source auditing.
Fixes: 76319a9d234f ("staging: gpib: Add hp82335x GPIB driver")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
drivers/gpib/hp_82335/hp82335.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpib/hp_82335/hp82335.c b/drivers/gpib/hp_82335/hp82335.c
index b7544b3c15c6..b1ef3dbdcdab 100644
--- a/drivers/gpib/hp_82335/hp82335.c
+++ b/drivers/gpib/hp_82335/hp82335.c
@@ -290,6 +290,8 @@ static int hp82335_attach(struct gpib_board *board, const struct gpib_board_conf
}
hp_priv->raw_iobase = upper_iomem_base;
tms_priv->mmiobase = ioremap(upper_iomem_base, hp82335_upper_iomem_size);
+ if (!tms_priv->mmiobase)
+ return -ENOMEM;
retval = request_irq(config->ibirq, hp82335_interrupt, 0, DRV_NAME, board);
if (retval) {
On Fri, Sep 11, 2026 at 02:09:27PM +0800, Slavin Liu wrote:
> Stop attach on mapping failure before board reset or register access.
> The existing detach path handles the reserved region and private state.
>
> Detected by static analysis and reviewed with AI-assisted source auditing.
>
> Fixes: 76319a9d234f ("staging: gpib: Add hp82335x GPIB driver")
> Assisted-by: LLM
> Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
> ---
> drivers/gpib/hp_82335/hp82335.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpib/hp_82335/hp82335.c b/drivers/gpib/hp_82335/hp82335.c
> index b7544b3c15c6..b1ef3dbdcdab 100644
> --- a/drivers/gpib/hp_82335/hp82335.c
> +++ b/drivers/gpib/hp_82335/hp82335.c
> @@ -290,6 +290,8 @@ static int hp82335_attach(struct gpib_board *board, const struct gpib_board_conf
> }
> hp_priv->raw_iobase = upper_iomem_base;
> tms_priv->mmiobase = ioremap(upper_iomem_base, hp82335_upper_iomem_size);
> + if (!tms_priv->mmiobase)
> + return -ENOMEM;
You just leaked memory :(
© 2016 - 2026 Red Hat, Inc.