Re: [PATCH 1/1] mmc: sdhci-spear: Fix NULL pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12 September 2013 13:43, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> On 12 September 2013 13:41, Sachin Kamat <sachin.kamat@xxxxxxxxxx> wrote:
>> Yes. That was my second option. If we do that we would get something as below:
>>
>>  84         /* If pdata is required */
>>  85         if (cd_gpio != -1) {
>>  86                pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
>>  87                if (!pdata) {
>>  88                    dev_err(&pdev->dev, "DT: kzalloc failed\n");
>>  89                    goto out;
>>  90                }
>>  91                pdata->card_int_gpio = cd_gpio;
>>  92                return pdata;
>>  93          }
>>  94
>>  95 out:
>>  96      return ERR_PTR(-ENODATA);
>>
>> Does this look OK?
>
> Or this:
>
>>  85         if (cd_gpio != -1) {
>>  86                pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
>>  87                if (!pdata)
>>  88                    dev_err(&pdev->dev, "DT: kzalloc failed\n");
>                         else
>>  91                    pdata->card_int_gpio = cd_gpio;
>>  93          }
>>  94
>>  96      return ERR_PTR(-ENODATA);

Wouldn't this be unconditional error return whether pdata is null or not?

-- 
With warm regards,
Sachin
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux