Up to now, all charge radius measurements of the proton and deuteron assumed uniform spheroidal charge distribution. We investigate the nuclear deformation effects on these charge radius measurements by assuming a uniform prolate charge distribution for the proton and deuteron. We solve the energy levels of the corresponding muonic and electric atoms with such deformed nucleus and present how the purely quadruple deformation of proton and deuteron affects their Lamb shifts. The numerical results suggest that the deformation of proton and deuteron leads to that the charge radius extracted from the electronic measurement should be smaller than the corresponding one in the muonic measurement which assumed uniform spheroidal charge distribution. If the central values of newest measurements for the proton are adopted, the proton would have a prolate structure with the 0.91 $mathrm{fm}$ long axis and 0.73 $mathrm{fm}$ short axis. Further improved precise charge radius measurements of the proton and deuteron will help us to pin down their shape deformation.