[PATCH] mtd: cfi_cmdset_0002: check return code for get_chip()

Christian Riesch christian.riesch at omicron.at
Thu Aug 14 01:30:32 PDT 2014


Hi Brian,
Thanks for catching this!

On Thu, Aug 14, 2014 at 8:35 AM, Brian Norris
<computersforpeace at gmail.com> wrote:
> Untested
>
> Coverity CID 1230633
>
> Signed-off-by: Brian Norris <computersforpeace at gmail.com>
> Cc: Christian Riesch <christian.riesch at omicron.at>
> ---
>  drivers/mtd/chips/cfi_cmdset_0002.c |    4 ++++
>  1 file changed, 4 insertions(+)

Tested-by: Christian Riesch <christian.riesch at omicron.at>

Regards,
Christian

>
> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> index 6da141af9cba..c50d8cf0f60d 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -1434,6 +1434,10 @@ static int cfi_amdstd_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
>
>                                 mutex_lock(&chip->mutex);
>                                 ret = get_chip(map, chip, base, FL_LOCKING);
> +                               if (ret) {
> +                                       mutex_unlock(&chip->mutex);
> +                                       return ret;
> +                               }
>
>                                 /* Enter lock register command */
>                                 cfi_send_gen_cmd(0xAA, cfi->addr_unlock1,
> --
> 1.7.9.5
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/



More information about the linux-mtd mailing list