Do you know that a penis is not under conscious control? It’s under the control of a guy’s autonomic nervous system – and that means that sometimes however much he wants an erection to go away, it won’t. Or, of course, however much he wants an erection to happen, it won’t – if that problem lasts more than a week or two, get a medical checkup.
Smoking can shrink your penis by as much as a centimeter during the course of your life – and will make it much less likely you can get an erection. So for sex’s sake, stop!