Re: [PATCH] dgnc: Don't save boards in memory that have failed to initialize

From: Giedrius StatkeviÄius
Date: Mon Mar 09 2015 - 12:19:04 EST


On 2015.03.09 17:27, Giedrius StatkeviÄius wrote:
> Remove BOARD_FAILED and don't save dgnc_boards which failed to
> initialize.
>
> Assign the result of kzalloc() to brd in dgnc_found_board() and only put
> it in the dgnc_Board[] if it successfully initializes. Also, remove
> BOARD_FAILED enum and all ifs that check for it. Finally, remove one
> final place where state was set to BOARD_FAILED which was even redundant
> before this patch.
>
> Signed-off-by: Giedrius StatkeviÄius <giedrius.statkevicius@xxxxxxxxx>
> ---
> drivers/staging/dgnc/dgnc_driver.c | 19 ++-----------------
> drivers/staging/dgnc/dgnc_driver.h | 3 +--
> drivers/staging/dgnc/dgnc_mgmt.c | 5 +----
> drivers/staging/dgnc/dgnc_tty.c | 8 --------
> 4 files changed, 4 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
> index fa1ee79..c73dc1f 100644
> --- a/drivers/staging/dgnc/dgnc_driver.c
> +++ b/drivers/staging/dgnc/dgnc_driver.c
> @@ -401,7 +401,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
> unsigned long flags;
>
> /* get the board structure and prep it */
> - dgnc_Board[dgnc_NumBoards] = kzalloc(sizeof(*brd), GFP_KERNEL);
> + brd = kzalloc(sizeof(*brd), GFP_KERNEL);
> brd = dgnc_Board[dgnc_NumBoards];
err, forgot to remove this here. Posting v2.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/