Use the return value of ines_allocate_private in calling code as early
return value in case of error.
Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@protonmail.com>
---
v3:
- Split commit into smaller pieces
- Improve changelog
- Change `(retval < 0)` to `(retval)`
drivers/gpib/ines/ines_gpib.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c
index a795b12ef8e0..737de5fef4b3 100644
--- a/drivers/gpib/ines/ines_gpib.c
+++ b/drivers/gpib/ines/ines_gpib.c
@@ -675,11 +675,13 @@ static int ines_generic_attach(struct gpib_board *board)
{
struct ines_priv *ines_priv;
struct nec7210_priv *nec_priv;
+ int retval;
board->status = 0;
- if (ines_allocate_private(board))
- return -ENOMEM;
+ retval = ines_allocate_private(board);
+ if (retval)
+ return retval;
ines_priv = board->private_data;
nec_priv = &ines_priv->nec7210_priv;
nec_priv->read_byte = nec7210_ioport_read_byte;
--
2.43.0