All pastes #1062588 Raw Edit

Diff

public text v1 · immutable
#1062588 ·published 2008-07-04 22:31 UTC
rendered paste body
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.cindex fd95b18..037a4f9 100644--- a/drivers/mmc/core/bus.c+++ b/drivers/mmc/core/bus.c@@ -182,6 +182,8 @@ static void mmc_release_card(struct device *dev) 	if (card->info) 		kfree(card->info); +	if (card->misaligned)+		card = card->misaligned; 	kfree(card); } @@ -191,10 +193,18 @@ static void mmc_release_card(struct device *dev) struct mmc_card *mmc_alloc_card(struct mmc_host *host, struct device_type *type) { 	struct mmc_card *card;+	void *mem; -	card = kzalloc(sizeof(struct mmc_card), GFP_KERNEL);-	if (!card)+	/* alloc 4 more bytes for alignment */+	mem = kzalloc(sizeof(struct mmc_card) + 4, GFP_KERNEL);+	if (!mem) 		return ERR_PTR(-ENOMEM);+	if ((unsigned)mem & 0x7) {+		card = mem;+	} else {+		card = mem + 4;+		card->misaligned = mem;+	}  	card->host = host; diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.hindex 0d508ac..d0fd26b 100644--- a/include/linux/mmc/card.h+++ b/include/linux/mmc/card.h@@ -111,6 +111,7 @@ struct mmc_card { 	unsigned		num_info;	/* number of info strings */ 	const char		**info;		/* info strings */ 	struct sdio_func_tuple	*tuples;	/* unknown common tuples */+	void			*misaligned;	/* pointer to kzalloc memory if misaligned */ };  #define mmc_card_mmc(c)		((c)->type == MMC_TYPE_MMC)