Re: [PATCH v5 2/5] mmc: block: Support alternative_gpt_sector() operation

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

 



18.08.2021 08:28, Christoph Hellwig пишет:
> On Wed, Aug 18, 2021 at 03:55:44AM +0300, Dmitry Osipenko wrote:
>> +static int mmc_blk_alternative_gpt_sector(struct block_device *bdev,
>> +					  sector_t *sector)
>> +{
>> +	struct mmc_card *card = mmc_bdev_to_card(bdev);
>> +
>> +	if (!card)
>> +		return -ENODEV;
>> +
>> +	if (!card->host->ops->alternative_gpt_sector)
>> +		return -EOPNOTSUPP;
>> +
>> +	return card->host->ops->alternative_gpt_sector(card, sector);
>> +}
>> +
> 
>> +static struct mmc_card *mmc_bdev_to_card(struct block_device *bdev)
>> +{
>> +	struct mmc_blk_data *md;
>> +
>> +	if (bdev->bd_disk->fops != &mmc_bdops)
>> +		return NULL;
> 
> No need for this check bow that it is only called through mmc_bdops.

Alright

>> +
>> +	md = mmc_blk_get(bdev->bd_disk);
>> +	if (!md)
>> +		return NULL;
>> +
>> +	return md->queue.card;
>> +}
> 
> This reference seems to never be dropped anywhere.
> 

Indeed, I missed that it bumps the refcnt.



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux