2n2222 transistor control motor from raspberry
Your connection scheme will burn out the transistor- the diode is forward biased and the transistor is an emitter follower. 

The 2N2222 not a very beefy transistor, the motor has to be very small for it to be appropriate. In any case, the correct method is more like this: 







simulate this circuit &ndash; Schematic created using CircuitLab

It would be better to subsitute a logic-level power MOSFET for the 2N2222 if the motor is more than 100mA or so. It's also better to use a Schottky diode for the flyback. 

Your ground connection is correct on your schematic.