On Mon, Mar 27, 2017 at 04:01:02PM +0530, Tejaswini wrote: > From: Tejaswini Poluri <tejaswinipolu...@gmail.com>
Please shorten the subject line: "[PATCH] hw/sd: simplify sd_init() prototype" > @@ -573,16 +573,19 @@ SDState *sd_init(BlockBackend *blk, bool is_spi) > qdev_prop_set_drive(dev, "drive", blk, &err); > if (err) { > error_report("sd_init failed: %s", error_get_pretty(err)); > - return NULL; > + return -1; > } > qdev_prop_set_bit(dev, "spi", is_spi); > object_property_set_bool(obj, true, "realized", &err); > if (err) { > error_report("sd_init failed: %s", error_get_pretty(err)); > - return NULL; > + return -1; > } > - > - return SD_CARD(dev); > + sd_state = SD_CARD(dev); The caller will not see the new value of sd_state. In C arguments are passed by value. That means they are local variables inside the function and do not affect the caller. I have CCed Paolo Bonzini, who posted this task. Maybe he can explain what he meant by "Include SDState by value instead of allocating it in sd_init (hw/sd/)". > + if (!sd_state) { > + return -1; > + } QEMU use 4 space indentation. Please do not use tabs.
signature.asc
Description: PGP signature