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

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

 



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.

> +
> +	md = mmc_blk_get(bdev->bd_disk);
> +	if (!md)
> +		return NULL;
> +
> +	return md->queue.card;
> +}

This reference seems to never be dropped anywhere.




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

  Powered by Linux